UNPKG

zumito-db

Version:

Multi-driver database abstraction layer with decorator-based models

20 lines (19 loc) 796 B
import { QueryIR, Operator } from './types.js'; import { DatabaseDriver } from './drivers/DriverInterface.js'; export declare class QueryBuilder<T = any> { private ir; private driver; constructor(driver: DatabaseDriver, collection: string); where(field: keyof T & string, operator: Operator, value: any): this; andWhere(field: keyof T & string, operator: Operator, value: any): this; orWhere(field: keyof T & string, operator: Operator, value: any): this; select(fields: (keyof T & string)[]): this; sort(field: keyof T & string, dir: 'asc' | 'desc'): this; limit(n: number): this; offset(n: number): this; populate(relation: string): this; exec(): Promise<T[]>; first(): Promise<T | null>; count(): Promise<number>; toIR(): QueryIR; }