/** * SQL Engine for ToonDB JavaScript SDK * * Provides SQL support on top of the KV storage backend. * Tables are stored as: * - Schema: _sql/tables/{table_name}/schema -> JSON schema definition * - Rows: _sql/tables/{table_name}/rows/{row_id} -> JSON row data * * @packageDocumentation */ /** * Result of a SQL query execution. */ export interface SQLQueryResult { /** Result rows */ rows: Array>; /** Column names */ columns: string[]; /** Number of rows affected (for INSERT/UPDATE/DELETE) */ rowsAffected: number; } /** * Parsed SQL operation result. */ type ParsedSQL = { operation: string; data: Record; }; /** * Simple SQL parser for DDL and DML operations. */ export declare class SQLParser { /** * Parse a SQL statement. */ static parse(sql: string): ParsedSQL; private static parseCreateTable; private static splitColumns; private static parseDropTable; private static parseCreateIndex; private static parseDropIndex; private static parseInsert; private static parseValues; private static parseValue; private static parseSelect; private static parseWhere; private static parseUpdate; private static parseDelete; } /** * Interface for database operations required by SQLExecutor. */ interface DatabaseInterface { get(key: Buffer | string): Promise; put(key: Buffer | string, value: Buffer | string): Promise; delete(key: Buffer | string): Promise; scan(prefix: string): Promise>; } /** * SQL Executor that operates on a KV database. */ export declare class SQLExecutor { private db; private readonly TABLE_PREFIX; private readonly SCHEMA_SUFFIX; private readonly ROWS_PREFIX; private readonly INDEX_PREFIX; constructor(db: DatabaseInterface); /** * Execute a SQL statement. */ execute(sql: string): Promise; private schemaKey; private rowKey; private rowPrefix; private indexMetaKey; private indexPrefix; private indexKey; private indexValuePrefix; private getSchema; private getIndexes; private hasIndexForColumn; private lookupByIndex; private updateIndex; private findIndexedEqualityCondition; private createTable; private dropTable; private createIndex; private dropIndex; private insert; private select; private matchesConditions; private update; private deleteRows; } export {}; //# sourceMappingURL=sql-engine.d.ts.map