Something went wrong. Try again.
A fluent interface implementation for creating different SQLite queries in TypeScript without having to write SQL directly.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142import type { Table, SQLiteColumnTypes, PrimaryKey, AlternateKey, ForeignKey,} from "../types.ts";
import { type WithPrimaryKeyColumn, withPrimaryKeyColumn as withPrimaryKeyColumnState,} from "../states/index.ts";
export type WithPrimaryKeyColumnTransition< TPrimaryKey extends Record<string, PrimaryKey>, TAlternateKeys extends Record<string, AlternateKey>, TForeignKeys extends Record<string, ForeignKey>,> = <const TNextName extends string, const TNextType extends SQLiteColumnTypes>( name: TNextName, type: TNextType,) => WithPrimaryKeyColumn< TPrimaryKey & Record<TNextName, PrimaryKey<TNextType>>, TAlternateKeys, TForeignKeys>;
export function withPrimaryKeyColumnTransition< TPrimaryKey extends Record<string, PrimaryKey>, TAlternateKeys extends Record<string, AlternateKey>, TForeignKeys extends Record<string, ForeignKey>,>( table: Table<TPrimaryKey, TAlternateKeys, TForeignKeys>,): WithPrimaryKeyColumnTransition<TPrimaryKey, TAlternateKeys, TForeignKeys> { return ((name, type) => { return withPrimaryKeyColumnState(table, name, type); }) as WithPrimaryKeyColumnTransition< TPrimaryKey, TAlternateKeys, TForeignKeys >;}