UNPKG

pretur.spec

Version:

MDA model specification builder for code generation

29 lines (28 loc) 1.33 kB
import { ModificationActions } from './relation'; import { Spec, SpecType } from './spec'; import { AttributeBuilder, NormalType } from './attribute'; export interface JoinSpecBuilder<J extends SpecType> { attribute: AttributeBuilder<J['fields']>; multicolumnUniqueIndex(...fields: (keyof J['fields'])[]): void; } export interface JoinKey<N extends string> { name: N; type?: NormalType; primary?: boolean; } export interface JoineeOptions<J extends SpecType, S extends SpecType, T extends SpecType> { spec: Spec<S>; aliasOnJoin: keyof J['records']; aliasOnTarget: keyof T['sets']; key: JoinKey<keyof J['fields']>; onDelete?: ModificationActions; onUpdate?: ModificationActions; } export declare function validateJoinee<J extends SpecType, S extends SpecType, T extends SpecType>(options: JoineeOptions<J, S, T>): void; export interface CreateJoinSpecOptions<J extends SpecType, F extends SpecType, S extends SpecType> { name: J['name']; scope: string; firstJoinee: JoineeOptions<J, F, S>; secondJoinee: JoineeOptions<J, S, F>; } export declare function createJoinSpec<J extends SpecType = SpecType, F extends SpecType = SpecType, S extends SpecType = SpecType>(options: CreateJoinSpecOptions<J, F, S>, initializer?: (specBuilder: JoinSpecBuilder<J>) => void): Spec<J>;