UNPKG

nukak

Version:

flexible and efficient ORM, with declarative JSON syntax and smart type-safety

48 lines (47 loc) 4.19 kB
import { type EntityMeta, type FieldKey, type FieldOptions, type NamingStrategy, type Query, type QueryComparisonOptions, type QueryConflictPaths, type QueryContext, type QueryDialect, type QueryOptions, type QueryPager, QueryRaw, type QueryRawFnOptions, type QuerySearch, type QuerySelect, type QuerySelectOptions, type QuerySort, type QueryWhere, type QueryWhereFieldOperatorMap, type QueryWhereMap, type QueryWhereOptions, type SqlQueryDialect, type Type } from '../type/index.js'; import { type CallbackKey } from '../util/index.js'; import { AbstractDialect } from './abstractDialect.js'; export declare abstract class AbstractSqlDialect extends AbstractDialect implements QueryDialect, SqlQueryDialect { readonly escapeIdChar: '`' | '"'; readonly beginTransactionCommand: string; readonly commitTransactionCommand: string; readonly rollbackTransactionCommand: string; constructor(namingStrategy?: NamingStrategy, escapeIdChar?: '`' | '"', beginTransactionCommand?: string, commitTransactionCommand?: string, rollbackTransactionCommand?: string); createContext(): QueryContext; addValue(values: unknown[], value: unknown): string; placeholder(_index: number): string; returningId<E>(entity: Type<E>): string; search<E>(ctx: QueryContext, entity: Type<E>, q?: Query<E>, opts?: QueryOptions): void; selectFields<E>(ctx: QueryContext, entity: Type<E>, select: QuerySelect<E>, opts?: QuerySelectOptions): void; select<E>(ctx: QueryContext, entity: Type<E>, select: QuerySelect<E>, opts?: QueryOptions): void; protected selectRelationFields<E>(ctx: QueryContext, entity: Type<E>, select: QuerySelect<E>, opts?: { prefix?: string; }): void; protected selectRelationJoins<E>(ctx: QueryContext, entity: Type<E>, select: QuerySelect<E>, opts?: { prefix?: string; }): void; where<E>(ctx: QueryContext, entity: Type<E>, where?: QueryWhere<E>, opts?: QueryWhereOptions): void; compare<E, K extends keyof QueryWhereMap<E>>(ctx: QueryContext, entity: Type<E>, key: K, val: QueryWhereMap<E>[K], opts?: QueryComparisonOptions): void; compareFieldOperator<E, K extends keyof QueryWhereFieldOperatorMap<E>>(ctx: QueryContext, entity: Type<E>, key: FieldKey<E>, op: K, val: QueryWhereFieldOperatorMap<E>[K], opts?: QueryOptions): void; protected addValues(ctx: QueryContext, vals: unknown[]): void; getComparisonKey<E>(ctx: QueryContext, entity: Type<E>, key: FieldKey<E>, { prefix }?: QueryOptions): void; sort<E>(ctx: QueryContext, entity: Type<E>, sort: QuerySort<E>, { prefix }: QueryOptions): void; pager(ctx: QueryContext, opts: QueryPager): void; count<E>(ctx: QueryContext, entity: Type<E>, q: QuerySearch<E>, opts?: QueryOptions): void; find<E>(ctx: QueryContext, entity: Type<E>, q?: Query<E>, opts?: QueryOptions): void; insert<E>(ctx: QueryContext, entity: Type<E>, payload: E | E[], opts?: QueryOptions): void; update<E>(ctx: QueryContext, entity: Type<E>, q: QuerySearch<E>, payload: E, opts?: QueryOptions): void; upsert<E>(ctx: QueryContext, entity: Type<E>, conflictPaths: QueryConflictPaths<E>, payload: E): void; protected getUpsertUpdateAssignments<E>(ctx: QueryContext, meta: EntityMeta<E>, conflictPaths: QueryConflictPaths<E>, payload: E, callback?: (columnName: string) => string): string; protected getUpsertConflictPathsStr<E>(meta: EntityMeta<E>, conflictPaths: QueryConflictPaths<E>): string; delete<E>(ctx: QueryContext, entity: Type<E>, q: QuerySearch<E>, opts?: QueryOptions): void; escapeId(val: string, forbidQualified?: boolean, addDot?: boolean): string; protected getPersistables<E>(ctx: QueryContext, meta: EntityMeta<E>, payload: E | E[], callbackKey: CallbackKey): Record<string, unknown>[]; protected getPersistable<E>(ctx: QueryContext, meta: EntityMeta<E>, payload: E, callbackKey: CallbackKey): Record<string, unknown>; protected formatPersistableValue<E>(ctx: QueryContext, field: FieldOptions, value: unknown): void; getRawValue(ctx: QueryContext, opts: QueryRawFnOptions & { value: QueryRaw; autoPrefixAlias?: boolean; }): void; abstract escape(value: unknown): string; }