@naturalcycles/mysql-lib
Version:
MySQL client implementing CommonDB interface
20 lines (19 loc) • 967 B
TypeScript
import type { DBQuery } from '@naturalcycles/db-lib';
import type { CommonLogger } from '@naturalcycles/js-lib/log';
import type { QueryOptions } from 'mysql';
/**
* Returns `null` if it detects that 0 rows will be returned,
* e.g when `IN ()` (empty array) is used.
*/
export declare function dbQueryToSQLSelect(q: DBQuery<any>): string | null;
/**
* Returns null in "0 rows" case.
*/
export declare function dbQueryToSQLDelete(q: DBQuery<any>): string | null;
/**
* Returns array of sql statements to respect the max sql size.
*/
export declare function insertSQL(table: string, rows: Record<any, any>[], verb?: 'INSERT' | 'REPLACE', logger?: CommonLogger): string[];
export declare function insertSQLSingle(table: string, record: Record<any, any>): string;
export declare function insertSQLSetSingle(table: string, record: Record<any, any>): QueryOptions;
export declare function dbQueryToSQLUpdate(q: DBQuery<any>, patch: Record<any, any>): string | null;