dblang/src/types.ts
jusax23 039ae26773
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Aliases and fiexes
2023-02-18 14:47:44 +01:00

66 lines
No EOL
1.6 KiB
TypeScript

import { AttributeAlias, TableAlias } from "./alias";
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 | AttributeAlias | Aggregation;
export type selectElements = primaryData | Attribute | AttributeAlias | Aggregation | selectQuery
export type selectFromElements = TableAlias | 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
}
export enum dbType {
mariadb,
//mysql,
postgres,
}