Typetypeno test imports ittype Type = "int" | "float" | "text" | "bool" | "timestamp" | "null" | "unknown";The types of the values of a language.
Catalog, names and types (commons lang-sql 0010-aide FR-003, FR-004): a Catalog says the tables and functions of a language; bind resolves the names of a query against it, with aliases and the scopes of subqueries, and typeOf and check give the type of an expression and each use that cannot be right. Everything is data and errors are values, with the span of the name and, for a name close to one that exists, the name that was meant.
Spec: 0010-aide FR-003, FR-004
Typetypeno test imports ittype Type = "int" | "float" | "text" | "bool" | "timestamp" | "null" | "unknown";The types of the values of a language.
TableSpecinterfaceno test imports itinterface TableSpecA table: its columns and their types, in order.
| Member | Type | What it is |
|---|---|---|
columns | Readonly<Record<string, Type>> |
FunctionSiginterfaceno test imports itinterface FunctionSigA function: the types of its parameters (undefined where any), how many it needs at least, and the type it gives.
| Member | Type | What it is |
|---|---|---|
name | string | |
params | readonly Type[] | undefined | |
minArgs | number | |
maxArgs | number | undefined | |
result | Type |
Cataloginterfaceinterface CatalogWhat a language's tables and functions are.
| Member | Type | What it is |
|---|---|---|
tables | Readonly<Record<string, TableSpec>> | |
functions | readonly FunctionSig[] |
BoundColumninterfaceno test imports itinterface BoundColumnA column that a name was resolved to.
| Member | Type | What it is |
|---|---|---|
table | string | |
alias | string | |
column | string | |
type | Type |
BindErrorinterfaceno test imports itinterface BindErrorSomething wrong with the names or types of a query.
| Member | Type | What it is |
|---|---|---|
start | number | |
end | number | |
message | string | |
suggestion? | string | The name that was meant, where one is close. |
Boundinterfaceno test imports itinterface BoundA query with its names resolved.
| Member | Type | What it is |
|---|---|---|
select | Select | |
catalog | Catalog | |
columns | ReadonlyMap<Name, BoundColumn> | The column each name of an expression stands for. |
tables | readonly { readonly name: string; readonly alias: string; }[] | The tables of the query's own FROM, with their aliases. |
TableDescriptioninterfaceno test imports itinterface TableDescriptionA table as another system says it: its columns' names and the types of that system.
| Member | Type | What it is |
|---|---|---|
name | string | |
columns | readonly { readonly name: string; readonly type: string; }[] |
catalogFromTablesfunctionfunction catalogFromTables(tables: readonly TableDescription[], types?: Readonly<Record<string, Type>>, functions?: readonly FunctionSig[]): CatalogA catalog of tables described in the types of another system; types maps those types (without regard to case) to the types of a catalog, and a type that is in neither is unknown.
closestfunctionfunction closest(name: string, candidates: readonly string[]): string | undefinedThe candidate closest to a name, where one is within two edits (the first in order where two are).
bindfunctionfunction bind(select: Select, catalog: Catalog): Result<Bound, readonly BindError[]>Resolves the names of a query against a catalog; every unknown table, unknown column and ambiguous column is an error value.
typeOffunctionfunction typeOf(e: Expr, b: Bound): TypeThe type of an expression of a bound query.
checkfunctionfunction check(b: Bound): readonly BindError[]Every use in a bound query that cannot be right: a comparison of text with a number, arithmetic on text, a function with the wrong number or types of arguments.