@seedts/types
Version:
Core TypeScript types and interfaces for SeedTS
50 lines • 1.24 kB
TypeScript
/**
* Base adapter interface for database integrations
*/
export interface SeedAdapter<T = any> {
/**
* Adapter name for identification
*/
name: string;
/**
* Insert records into the database
*/
insert(tableName: string, data: T[]): Promise<T[]>;
/**
* Update existing records in the database
*/
update(tableName: string, data: T[]): Promise<T[]>;
/**
* Delete records from the database
*/
delete(tableName: string, ids: any[]): Promise<void>;
/**
* Query records from the database
*/
query(tableName: string, conditions?: any): Promise<T[]>;
/**
* Begin a database transaction
*/
beginTransaction(): Promise<void>;
/**
* Commit the current transaction
*/
commit(): Promise<void>;
/**
* Rollback the current transaction
*/
rollback(): Promise<void>;
/**
* Check if transactions are supported
*/
supportsTransactions(): boolean;
/**
* Optional: Truncate a table (useful for cleanup)
*/
truncate?(tableName: string): Promise<void>;
/**
* Optional: Close database connection
*/
disconnect?(): Promise<void>;
}
//# sourceMappingURL=adapter.d.ts.map