CatalogOptionsinterfaceno test imports itinterface CatalogOptionsWhat a catalog is made with.
| Member | Type | What it is |
|---|---|---|
dialect | Dialect | |
naming? | Naming | |
schema? | string | The schema the tables are in, as bind was given it. |
A catalog of queries (commons data 0024-sql-queries): SQL a person writes over the names of a schema, with typed parameters that enter only as literals, read-only by construction, and compared between versions of a schema.
CatalogOptionsinterfaceno test imports itinterface CatalogOptionsWhat a catalog is made with.
| Member | Type | What it is |
|---|---|---|
dialect | Dialect | |
naming? | Naming | |
schema? | string | The schema the tables are in, as bind was given it. |
impactfunctionfunction impact(specs: readonly QuerySpec[], from: LogicalSchema, to: LogicalSchema, options: CatalogOptions): readonly Impact[]What a change to a schema does to each query.
| Parameter | What it is |
|---|---|
specs | the queries |
from | the schema before |
to | the schema after |
options | the dialect, naming and the tables' schema |
Returns: for each query: fine in both, breaks (fine before, broken after), broken in both, or fixed (broken before, fine after)
Impactinterfaceno test imports itinterface ImpactWhat a change does to a query.
| Member | Type | What it is |
|---|---|---|
query | string | |
status | "breaks" | "broken" | "fine" | "fixed" | |
errors | readonly QueryError[] | Why it is broken in the second version. |
ParamErrortypeno test imports ittype ParamError =
| { readonly kind: "missing"; readonly param: string }
| { readonly kind: "unknown"; readonly param: string }
| { readonly kind: "type"; readonly param: string; readonly expected: ParamType }
| { readonly kind: "null"; readonly param: string };Why a parameter of a catalogued query is refused, as a value.
ParamSpecinterfaceno test imports itinterface ParamSpecA parameter: its type, and whether it may be null.
| Member | Type | What it is |
|---|---|---|
type | ParamType | |
nullable? | boolean |
ParamTypetypeno test imports ittype ParamType = "text" | "integer" | "number" | "boolean";The type of a parameter.
QueryErrortypeno test imports ittype QueryError =
| RefError
| { readonly kind: "duplicate"; readonly name: string }
| { readonly kind: "not-read-only"; readonly query: string; readonly why: string }
| { readonly kind: "unknown-param"; readonly query: string; readonly param: string };Why a catalogued query cannot be found or run, as a value.
QuerySpecinterfaceinterface QuerySpecWhat a project says of a query.
| Member | Type | What it is |
|---|---|---|
name | string | |
params? | Readonly<Record<string, ParamSpec | ParamType>> | |
sql | (refs: Refs, param: (name: string) => string) => string | The SQL, given the references of the schema and a function that gives the place of a parameter. |
queriesfunctionfunction queries(schema: LogicalSchema, specs: readonly QuerySpec[], options: CatalogOptions): Result<Catalog, readonly QueryError[]>A catalog of queries.
| Parameter | What it is |
|---|---|
schema | the logical schema |
specs | the queries |
options | the dialect, naming and the tables' schema |
Returns: the catalog, or why not
readOnlyfunctionfunction readOnly(sql: string, dialect?: string): string | undefinedWhy a query is not read-only, or nothing: the guard of the SQL language library reads it with the parser of the dialect (0024-sql-queries FR-003), so that a word of a write in a string, a quoted name or a comment is not a write, and the places of its parameters are read as NULL.