@cdellacqua/knex-transact
Version:
transact function that provides a simple mechanism to translate SQL transactions into code
9 lines (8 loc) • 472 B
TypeScript
import { Knex } from "knex";
export type TransactionCode<T> = (trx: Knex.Transaction) => Promise<T>;
export type NextTransactionCode<T = any> = (trx: Knex.Transaction, previousValue?: any) => Promise<T>;
export declare const config: {
knexInstance?: Knex;
};
export declare function transact<T>(provider: TransactionCode<T>, trx?: Knex.Transaction): Promise<T>;
export declare function transact<T>(provider: NextTransactionCode[], trx?: Knex.Transaction): Promise<T>;