UNPKG

sheets-orm

Version:

Mengakses Google Sheets seperti database dengan query mirip ORM

26 lines 1.28 kB
export declare class GoogleSheetsORM<T extends Record<string, any>> { private getSheets; private spreadsheetId; private sheetName; private beforeInsertHook?; private afterInsertHook?; private beforeUpdateHook?; private afterUpdateHook?; constructor(spreadsheetId: string, sheetName: string); /** 🟢 Register Hooks */ onBeforeInsert(hook: (data: Partial<T>) => Promise<void>): void; onAfterInsert(hook: (data: Partial<T>) => Promise<void>): void; onBeforeUpdate(hook: (data: Partial<T>) => Promise<void>): void; onAfterUpdate(hook: (data: Partial<T>) => Promise<void>): void; /** 🟢 Get all records with optional filtering & pagination */ findAll(filter?: Partial<T>, limit?: number, offset?: number): Promise<T[]>; /** 🔍 Find a single record by column */ findOne(column: keyof T, value: string): Promise<T | null>; /** ➕ Insert new data with validation & hook */ insert(data: Partial<T>): Promise<void>; /** ✏️ Update record by column with validation & hook */ update(column: keyof T, value: string, newData: Partial<T>): Promise<boolean>; /** 🗑️ Delete record by column */ delete(column: keyof T, value: string): Promise<boolean>; } //# sourceMappingURL=orm.d.ts.map