@starbemtech/star-db-query-builder
Version:
A query builder to be used with mysql or postgres
21 lines (20 loc) • 1.15 kB
TypeScript
import { QueryParams } from './types';
export declare const findFirst: <T>({ tableName, dbClient, select, where, groupBy, orderBy, }: QueryParams<T>) => Promise<T | null>;
export declare const findMany: <T>({ tableName, dbClient, select, where, groupBy, orderBy, limit, offset, unaccent, }: QueryParams<T>) => Promise<T[]>;
export declare const insert: <P, R>({ tableName, dbClient, data, returning, }: QueryParams<R> & {
data: P;
returning?: string[];
}) => Promise<R>;
export declare const update: <P, R>({ tableName, dbClient, id, data, returning, }: QueryParams<R> & {
data: P;
returning?: string[];
}) => Promise<R | void>;
export declare const deleteOne: <T>({ tableName, dbClient, id, permanently, }: QueryParams<T> & {
permanently?: boolean;
}) => Promise<void>;
export declare const deleteMany: <T>({ tableName, dbClient, ids, field, permanently, }: QueryParams<T> & {
ids: string[] | number[];
field?: string;
permanently?: boolean;
}) => Promise<void>;
export declare const joins: <T>({ tableName, dbClient, select, joins, where, groupBy, orderBy, limit, offset, unaccent, }: QueryParams<T>) => Promise<T[]>;