///
type Value = string | number | bigint | boolean | null | Date | Array | Array | Array | Array | Buffer;
export type RawQuery = (k: string) => (string | {
query: string;
bindings: Value[];
}) | {
operand: string;
bindings: Value[];
};
export type InsertId = bigint | number;
type FindOperatorComp = Partial<{
">=": T | RawQuery;
">": T | RawQuery;
"<=": T | RawQuery;
"<": T | RawQuery;
"!=": T | RawQuery;
LIKE: T | RawQuery;
"LIKE%": T;
"%LIKE": T;
"%LIKE%": T;
NOT_IN: Array;
IS_NULL: boolean;
IS_NOT_NULL: boolean;
$AND: Array>;
$OR: Array>;
}>;
export type FindChainingConditions = Partial<{
$AND: FindChainingConditions | FindConditions | Array>;
$OR: FindChainingConditions | FindConditions | Array>;
}>;
export type FindConditions = {
[P in keyof T]?: T[P] | T[P][] | FindOperatorComp | RawQuery;
};
export type OrderCondition = {
[P in keyof T]?: "ASC" | "DESC" | RawQuery;
} | ((aliases: {
[key: string]: string;
}) => string);
export type OrderConditions = OrderCondition | Array>;
export interface FindOneOptions {
select?: (keyof T)[];
where?: FindConditions | FindChainingConditions;
order?: OrderConditions;
debug?: boolean;
forUpdate?: boolean;
}
export interface FindOptions extends FindOneOptions {
offset?: number | bigint;
limit?: number | bigint;
distinct?: boolean;
}
export interface CountOptions extends Omit, "select" | "order"> {
}
export interface PaginationOptions extends FindOneOptions {
page?: number;
rpp?: number;
}
export interface Paginatable {
page: number;
rpp: number;
count: bigint;
items: Array;
}
export interface UpdateOptions {
where?: FindConditions;
update?: (keyof T)[];
debug?: boolean;
}
export interface UpdateBulkOptions {
update: (keyof T)[];
debug?: boolean;
}
export interface UpsertOptions {
update: (keyof T)[];
debug?: boolean;
}
export interface DeleteOptions {
where?: FindConditions;
debug?: boolean;
}
export interface StreamFunctions {
onData: (row: T) => void;
onStreamEnd?: () => void;
}
export {};