nukak
Version:
flexible and efficient ORM, with declarative JSON syntax and smart type-safety
39 lines (38 loc) • 2.74 kB
TypeScript
import { type EntityMeta, type FieldKey, type Query, type QueryComparisonOptions, type QueryConflictPaths, 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 Scalar, type Type } from '../type/index.js';
import { type CallbackKey } from '../util/index.js';
export declare abstract class AbstractSqlDialect implements QueryDialect {
readonly escapeIdChar: '`' | '"';
readonly beginTransactionCommand: string;
readonly escapeIdRegex: RegExp;
constructor(escapeIdChar?: '`' | '"', beginTransactionCommand?: string);
returningId<E>(entity: Type<E>): string;
search<E>(entity: Type<E>, q?: Query<E>, opts?: QueryOptions): string;
selectFields<E>(entity: Type<E>, select: QuerySelect<E>, opts: QuerySelectOptions): string;
selectRelations<E>(entity: Type<E>, select?: QuerySelect<E>, { prefix }?: {
prefix?: string;
}): {
fields: string;
tables: string;
};
select<E>(entity: Type<E>, select: QuerySelect<E>, opts?: QueryOptions): string;
where<E>(entity: Type<E>, where: QueryWhere<E>, opts: QueryWhereOptions): string;
compare<E, K extends keyof QueryWhereMap<E>>(entity: Type<E>, key: K, val: QueryWhereMap<E>[K], opts?: QueryComparisonOptions): string;
compareFieldOperator<E, K extends keyof QueryWhereFieldOperatorMap<E>>(entity: Type<E>, key: FieldKey<E>, op: K, val: QueryWhereFieldOperatorMap<E>[K], opts?: QueryOptions): string;
getComparisonKey<E>(entity: Type<E>, key: FieldKey<E>, { prefix }?: QueryOptions): Scalar;
sort<E>(entity: Type<E>, sort: QuerySort<E>, { prefix }: QueryOptions): string;
pager(opts: QueryPager): string;
count<E>(entity: Type<E>, q: QuerySearch<E>, opts?: QueryOptions): string;
find<E>(entity: Type<E>, q: Query<E>, opts?: QueryOptions): string;
insert<E>(entity: Type<E>, payload: E | E[]): string;
update<E>(entity: Type<E>, q: QuerySearch<E>, payload: E, opts?: QueryOptions): string;
upsert<E>(entity: Type<E>, conflictPaths: QueryConflictPaths<E>, payload: E): string;
delete<E>(entity: Type<E>, q: QuerySearch<E>, opts?: QueryOptions): string;
escapeId(val: string, forbidQualified?: boolean, addDot?: boolean): string;
getPersistable<E>(meta: EntityMeta<E>, payload: E, callbackKey: CallbackKey): E;
getPersistables<E>(meta: EntityMeta<E>, payload: E | E[], callbackKey: CallbackKey): E[];
getRawValue(opts: QueryRawFnOptions & {
value: QueryRaw;
autoPrefixAlias?: boolean;
}): string;
abstract escape(value: unknown): string;
}