1.5.1 • Published 3 years ago
@nest-toolbox/typeorm-upsert v1.5.1
typeorm-upsert
Installation
npm i @nest-toolbox/typeorm-upsert
Usage
const dataTypeRepository; // typeorm repository
const bigArrayWithData = []; // this array contains existing data and new data
const conflictKey = 'unq index/key'; // you can use this function in the case you want to track collision on other key then id;
const options = { // all the options are optional
keyNamingTransform: (k)=>k, // you can pass a callback function to change the keys in case that your having a naming convention like snake_case
doNotUpsert: [], // array of keys that you want to ignore durning the upsert maybe a status field or something
chunk: 1000, // by default the function chunks the array in 1000 inserts you can increase or decrease this option
};
const updated = await TypeOrmUpsert(dataTypeRepository, bigArrayWithData, conflictKey, {
doNotUpsert: ['name'],
});
1.5.1
3 years ago
1.4.19
3 years ago
1.4.17
3 years ago
1.4.9
3 years ago
1.4.8
3 years ago
1.4.7
3 years ago
1.4.4
4 years ago
1.4.2
4 years ago
1.4.0
4 years ago
1.3.1
4 years ago
1.3.0
4 years ago
1.2.1
5 years ago
1.1.20
5 years ago
1.1.18
5 years ago
1.1.12
5 years ago
1.1.13
5 years ago
1.1.9
5 years ago
1.1.8
5 years ago
1.1.7
5 years ago
1.1.6
5 years ago
1.1.5
5 years ago
1.1.3
5 years ago
1.1.2
5 years ago
1.1.1
5 years ago