CoolFace
Apppublic

AK-21/Graphite-Industrial-Intelligence

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
dialect.d.cts68 linesDownload Raw Back to sqlite-core
1import { entityKind } from "../entity.cjs";2import type { MigrationConfig, MigrationMeta } from "../migrator.cjs";3import { type BuildRelationalQueryResult, type DBQueryConfig, type Relation, type TableRelationalConfig, type TablesRelationalConfig } from "../relations.cjs";4import { type QueryWithTypings, SQL } from "../sql/sql.cjs";5import { SQLiteColumn } from "./columns/index.cjs";6import type { SQLiteDeleteConfig, SQLiteInsertConfig, SQLiteUpdateConfig } from "./query-builders/index.cjs";7import { SQLiteTable } from "./table.cjs";8import { type Casing, type UpdateSet } from "../utils.cjs";9import type { SQLiteSelectConfig } from "./query-builders/select.types.cjs";10import type { SQLiteSession } from "./session.cjs";11export interface SQLiteDialectConfig {12    casing?: Casing;13}14export declare abstract class SQLiteDialect {15    static readonly [entityKind]: string;16    constructor(config?: SQLiteDialectConfig);17    escapeName(name: string): string;18    escapeParam(_num: number): string;19    escapeString(str: string): string;20    private buildWithCTE;21    buildDeleteQuery({ table, where, returning, withList, limit, orderBy, }: SQLiteDeleteConfig): SQL;22    buildUpdateSet(table: SQLiteTable, set: UpdateSet): SQL;23    buildUpdateQuery({ table, set, where, returning, withList, joins, from, limit, orderBy, }: SQLiteUpdateConfig): SQL;24    /**25     * Builds selection SQL with provided fields/expressions26     *27     * Examples:28     *29     * `select <selection> from`30     *31     * `insert ... returning <selection>`32     *33     * If `isSingleTable` is true, then columns won't be prefixed with table name34     */35    private buildSelection;36    private buildJoins;37    private buildLimit;38    private buildOrderBy;39    private buildFromTable;40    buildSelectQuery({ withList, fields, fieldsFlat, where, having, table, joins, orderBy, groupBy, limit, offset, distinct, setOperators, }: SQLiteSelectConfig): SQL;41    buildSetOperations(leftSelect: SQL, setOperators: SQLiteSelectConfig['setOperators']): SQL;42    buildSetOperationQuery({ leftSelect, setOperator: { type, isAll, rightSelect, limit, orderBy, offset }, }: {43        leftSelect: SQL;44        setOperator: SQLiteSelectConfig['setOperators'][number];45    }): SQL;46    buildInsertQuery({ table, values: valuesOrSelect, onConflict, returning, withList, select, }: SQLiteInsertConfig): SQL;47    sqlToQuery(sql: SQL, invokeSource?: 'indexes' | undefined): QueryWithTypings;48    buildRelationalQuery({ fullSchema, schema, tableNamesMap, table, tableConfig, queryConfig: config, tableAlias, nestedQueryRelation, joinOn, }: {49        fullSchema: Record<string, unknown>;50        schema: TablesRelationalConfig;51        tableNamesMap: Record<string, string>;52        table: SQLiteTable;53        tableConfig: TableRelationalConfig;54        queryConfig: true | DBQueryConfig<'many', true>;55        tableAlias: string;56        nestedQueryRelation?: Relation;57        joinOn?: SQL;58    }): BuildRelationalQueryResult<SQLiteTable, SQLiteColumn>;59}60export declare class SQLiteSyncDialect extends SQLiteDialect {61    static readonly [entityKind]: string;62    migrate(migrations: MigrationMeta[], session: SQLiteSession<'sync', unknown, Record<string, unknown>, TablesRelationalConfig>, config?: string | MigrationConfig): void;63}64export declare class SQLiteAsyncDialect extends SQLiteDialect {65    static readonly [entityKind]: string;66    migrate(migrations: MigrationMeta[], session: SQLiteSession<'async', any, any, any>, config?: string | MigrationConfig): Promise<void>;67}68