sqlmongoose
Version:
Mongoose-like schemas and models for SQLite3
26 lines (25 loc) • 652 B
TypeScript
export interface QueryCondition {
[key: string]: {
operator: string;
value: any;
};
}
export declare class QueryBuilder<T> {
private tableName;
private conditions;
private values;
private limitValue?;
private offsetValue?;
private orderByValues;
private includeFields;
constructor(tableName: string);
where(condition: Partial<T> | QueryCondition): this;
select(...fields: (keyof T)[]): this;
limit(limit: number): this;
offset(offset: number): this;
orderBy(field: keyof T, direction: 'ASC' | 'DESC'): this;
build(): {
sql: string;
values: any[];
};
}