dblang/src/types.ts
jusax23 580988e2c0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
joins
2023-02-15 13:58:19 +01:00

59 lines
No EOL
1.5 KiB
TypeScript

import { Attribute, Table } from "./db";
import { Aggregation, BooleanModifier, Datatype, Joins, Modifier } from "./dbStructure";
import { QueryBuilder, selectQuery } from "./query";
export type primaryData = string | number | boolean | null;
export type allModifierInput = primaryData | Modifier | selectQuery | Attribute | Aggregation;
export type selectElements = primaryData | Attribute | Aggregation | selectQuery
export type selectFromElements = Table | Joins | null;
export type joinElements = Table | Joins;
export type serializeReturn = [string, primaryData[]];
export type DatatypeBuild = [QueryBuilder, number];
export type attributeSettings = {
unique?: boolean,
autoIncrement?: boolean,
default?: primaryData,
notNull?: boolean
primaryKey?: boolean,
foreginKey?: {
link: Attribute,
onDelete?: onAction,
onUpdate?: onAction
},
check?: BooleanModifier | ((a: Attribute) => BooleanModifier)
};
export type extendedAttributeSettings = {
type: Datatype,
unique?: boolean,
autoIncrement?: boolean,
default?: primaryData,
notNull?: boolean
primaryKey?: boolean,
foreginKey?: {
link: Attribute,
onDelete?: onAction,
onUpdate?: onAction
},
check?: BooleanModifier | ((a: Attribute) => BooleanModifier)
}
export enum onAction {
nothing,
cascade,
noAction,
setNull,
setDefault
}
export enum joinType {
inner,
left,
right,
full,
cross
}