BindContextinterfaceinterface BindContextWhat a source is given.
| Member | Type | What it is |
|---|---|---|
schema | LogicalSchema | |
dialect | Dialect | |
naming | Naming | |
written | Written | |
schemaName? | string | The schema the tables are in, as the project gave it. |
What bind makes and what an extension may add (commons data 0007-physical): a statement is a piece of SQL with its group and the logical elements it was made from, so that what is in a database is traced back; a physical schema is the statements in the order the groups say; and a source is what an extension is given to add statements for a bound schema, with the written name of every table and column.
BindContextinterfaceinterface BindContextWhat a source is given.
| Member | Type | What it is |
|---|---|---|
schema | LogicalSchema | |
dialect | Dialect | |
naming | Naming | |
written | Written | |
schemaName? | string | The schema the tables are in, as the project gave it. |
GROUPSconstconst GROUPS: readonly Group[]The groups in the order their statements are run.
Grouptypeno test imports ittype Group = "setup" | "table" | "constraint" | "index" | "data" | "view" | "routine" | "documentation" | "policy";Where a statement goes: tables, then what is added to them, then indexes, then the reference data, then documentation, then policies.
Origintypeno test imports ittype Origin = "core" | "extension";Whether a statement is the core's, made from the logical schema, or an extension's (0011-sql-lifecycle FR-003).
Physicalinterfaceinterface PhysicalA bound schema: the statements, in the order of their groups.
| Member | Type | What it is |
|---|---|---|
dialect | string | |
naming | { readonly names: string; readonly codes: string; } | |
statements | readonly Statement[] |
PhysicalErrortypetype PhysicalError =
| { readonly kind: "unsupported"; readonly element: LogicalId; readonly why: string }
| { reado… (420 characters)type PhysicalError =
| { readonly kind: "unsupported"; readonly element: LogicalId; readonly why: string }
| { readonly kind: "length"; readonly element: LogicalId; readonly name: string; readonly max: number }
| { readonly kind: "collision"; readonly name: string; readonly table?: string; readonly first: LogicalId; readonly second: LogicalId }
| { readonly kind: "cycle"; readonly tables: readonly string[] };What is wrong with a binding; bind returns all of it together.
clausesFromfunctionno test imports itfunction clausesFrom(composition: Composition): readonly TableClause[]The table clauses of a composition, in its order.
| Parameter | What it is |
|---|---|
composition | the project's composition |
Returns: the clauses its extensions contribute
renderfunctionfunction render(physical: Physical): stringThe statements as the text of a script: a blank line between them, the same text every time.
| Parameter | What it is |
|---|---|
physical | the bound schema |
Returns: the script
sourcesFromfunctionfunction sourcesFrom(composition: Composition): readonly StatementSource[]The sources of a composition, in its order.
| Parameter | What it is |
|---|---|
composition | the project's composition |
Returns: the sources its extensions contribute
TableClausetypeno test imports ittype TableClause = (context: BindContext, table: Table) => Result<string | undefined, readonly PhysicalError[]>;What an extension gives bind to add to the end of a table's CREATE TABLE: a clause, nothing for a table it has none for, or its errors (0009-sql-features FR-004).
tableClausesPointconstno test imports itconst tableClausesPoint: ContributionPoint<TableClause>The contribution point an extension fills to add a clause to a table.
Statementinterfaceno test imports itinterface StatementOne piece of SQL, ending in ;.
| Member | Type | What it is |
|---|---|---|
group | Group | |
origin? | Origin | Who made it: bind sets it, so an extension never has to. |
sql | string | |
of | readonly LogicalId[] | The elements of the logical schema it was made from. |
StatementSourcetypetype StatementSource = (context: BindContext) => Result<readonly Statement[], readonly PhysicalError[]>;What an extension gives bind: statements for a bound schema, or its errors.
statementsPointconstconst statementsPoint: ContributionPoint<StatementSource>The contribution point an extension fills to add statements.
Writteninterfaceno test imports itinterface WrittenThe names that were written, by the logical element they are the name of.
| Member | Type | What it is |
|---|---|---|
qualifier | string | undefined | The schema tables are qualified by, where the dialect has schemas and one was given. |
ref | (id: LogicalId) => string | The reference to a table of the schema, quoted and qualified (0013-sql-qualified-names FR-004). |
qualify | (name: string) => string | The reference to a table of an extension, by the bare name it is written by: qualified, or with the schema's words added where the dialect has no schemas. |
tableName | (name: string) => string | The name a table of an extension is written by once the schema's words are added where the dialect has no schemas. |
table | (id: LogicalId) => string | undefined | |
column | (id: LogicalId) => string | undefined | |
constraint | (id: LogicalId) => string | undefined |