canHavefunctionno test imports itfunction canHave(dialect: Dialect, kind: "domain" | "enum" | "extension" | "schema" | "sequence"): booleanWhich kinds of object a dialect has.
The objects of a database that are not tables, views or indexes (commons data 0048-sql-objects): schemas, sequences, enumerated types, PostgreSQL's domains and extensions. Each is a value that says what it is; objectsSource writes them for a dialect that has them, in the setup group, before the tables, so that a table or a routine can use them. Each is made so that making it again changes nothing (PostgreSQL has no IF NOT EXISTS for a type or a domain, so those are guarded by a look at the catalog). An object a dialect cannot have is an error value naming it, unless the project says to carry it.
canHavefunctionno test imports itfunction canHave(dialect: Dialect, kind: "domain" | "enum" | "extension" | "schema" | "sequence"): booleanWhich kinds of object a dialect has.
DbObjecttypeno test imports ittype DbObject =
| { readonly kind: "schema"; readonly name: string }
| { readonly kind: "sequence"; readonly name: s… (647 characters)type DbObject =
| { readonly kind: "schema"; readonly name: string }
| { readonly kind: "sequence"; readonly name: string; readonly schema?: string; readonly start?: number; readonly increment?: number; readonly cache?: number; readonly cycle?: boolean }
| { readonly kind: "enum"; readonly name: string; readonly schema?: string; readonly values: readonly string[] }
| { readonly kind: "domain"; readonly name: string; readonly schema?: string; readonly type: LogicalType; readonly notNull?: boolean; readonly default?: string; readonly check?: string }
| { readonly kind: "extension"; readonly name: string; readonly schema?: string };An object of a database.
enumOffunctionfunction enumOf(list: AnyCodeList, options?: { readonly schema?: string | undefined; readonly name?: string | undefined; }): (context: Pick<BindContext, "naming">) => DbObjectThe enumerated type of a closed code list, its values written as the dialect's codes are (employed_by).
enumTypeconstconst enumType: (name: string, values: readonly string[], options?: { readonly schema?: string | undefined; }) => DbObjectAn enumerated type: its values are what a column of it may hold, in order.
objectsSourcefunctionfunction objectsSource(objects: readonly (((c: Pick<BindContext, "naming">) => DbObject) | DbObject)[], settings?: ObjectsSettings): StatementSourceThe statements of some objects.
| Parameter | What it is |
|---|---|
objects | the objects, or what makes them from the bind context (enumOf) |
settings | what a project says |
Returns: a statement source
ObjectsSettingsinterfaceno test imports itinterface ObjectsSettingsWhat a project says of objects.
| Member | Type | What it is |
|---|---|---|
unsupported? | "carry" | "refuse" | What to do with an object the dialect cannot have: refuse (an error value, the default) or carry (nothing is written). |
pgDomainconstconst pgDomain: (name: string, type: LogicalType, options?: { readonly schema?: string | undefined; readonly notNull?: boolean | undefined; readonly default?: string | undefined; readonly check?: string | undefined; }) => DbObjectA domain (PostgreSQL): a type with a rule, which a column or a routine can use as it uses the type.
schemaconstconst schema: (name: string) => DbObjectA schema.
sequenceconstconst sequence: (name: string, options?: { readonly schema?: string | undefined; readonly start?: number | undefined; readonly increment?: number | undefined; readonly cache?: number | undefined; readonly cycle?: boolean | undefined; }) => DbObjectA sequence of numbers.
statementOffunctionfunction statementOf(o: DbObject, dialect: Dialect): stringThe statement that makes an object, for a dialect that has it.