1.3.6 • Published 1 year ago

tgw-knex-extensions v1.3.6

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

tgw-knex-extensions

npm i tgw-knex-extensions

HOW TO USE:

import Knex from 'tgw-knex-extensions'
const config = {
    client: 'mssql',
    connection: {
        host : process.env.DB_HOST,
        port : Number(process.env.DB_PORT),
        user : process.env.DB_USER,
        password : process.env.DB_PWD,
        database : process.env.DB_NAME,
    }
}
const knex = Knex(config)

UPSERT FOR MSSQL

knex(tableName: string).mssqlUpsert(keyName: string, data: any[], options)

DELUPSERT FOR MSSQL

knex(tableName: string).delupsert(keyName: string, data: any[], options)

DELUPSERT LINE ITEMS FOR MSSQL

knex(tableName: string).delupsertLineItems(mainKeyName: string, lineItemKeyName: string, data: any[], options)

OPTIONS

<!-- options default is {dataCanEmpty: false, incrementKey: false} -->

if dataCanEmpty = false, data is empty tgw-knex-extensions will throw a error
if dataCanEmpty = true, data is empty tgw-knex-extensions will return [{message:'No data to execute!'}]

if incrementKey = true insert and update with table have primary key auto increment
if incrementKey = false insert and update with table have primary key not auto increment
1.3.6

1 year ago

1.3.5

1 year ago

1.3.4

1 year ago

1.3.3

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago