1.5.1 • Published 1 year ago

@nest-toolbox/typeorm-upsert v1.5.1

Weekly downloads
210
License
MIT
Repository
github
Last release
1 year ago

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

1 year ago

1.4.19

2 years ago

1.4.17

2 years ago

1.4.9

2 years ago

1.4.8

2 years ago

1.4.7

2 years ago

1.4.4

3 years ago

1.4.2

3 years ago

1.4.0

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.1

4 years ago

1.1.20

4 years ago

1.1.18

4 years ago

1.1.12

4 years ago

1.1.13

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago