@flavoai/fastfold
Version:
Flavo frontend package
56 lines • 1.8 kB
TypeScript
import { QueryParams } from '../../types';
export declare class DrizzleAdapter {
private db;
private schema;
constructor(db: any, schema: Record<string, any>);
/**
* Get table schema object by name
*/
getTable(tableName: string): any;
/**
* Query records from a table
*/
query<T = any>(tableName: string, params?: QueryParams): Promise<T[]>;
/**
* Create a new record
* Auto-injects createdAt and updatedAt timestamps if the table has those columns
*/
create<T = any>(tableName: string, data: any): Promise<T>;
/**
* Update a record by ID
* Auto-injects updatedAt timestamp if the table has that column
*/
update<T = any>(tableName: string, id: string | number, data: any): Promise<T>;
/**
* Delete a record by ID
*/
delete(tableName: string, id: string | number): Promise<boolean>;
/**
* Count records in a table
*/
count(tableName: string, where?: Record<string, any>): Promise<number>;
/**
* Find a single record by ID
*/
findById<T = any>(tableName: string, id: string | number): Promise<T | null>;
/**
* Query with relations using Drizzle's relational query API
*/
queryWithRelations<T = any>(tableName: string, params?: QueryParams & {
with?: Record<string, boolean>;
}): Promise<T[]>;
/**
* Coerce date string values to Date objects for timestamp columns.
* Drizzle's SQLiteTimestamp calls .getTime() internally, which fails on strings.
*/
private coerceDateFields;
/**
* Build where conditions for Drizzle queries
*/
private buildWhereConditions;
/**
* Get available table names from schema
*/
getTableNames(): string[];
}
//# sourceMappingURL=drizzle.d.ts.map