IF Commons GitHub

sql/physical/refs

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0007-physical FR-014

References for text written by people (commons data 0007-physical FR-014): a query or a transform is SQL a person writes, and the names in it are a schema's, written by the naming layer for a dialect and a schema qualifier. A Refs gives the written, quoted name of a table or a column from the words of its name, and keeps what is not there as an error value, so that a name that does not exist is found when the SQL is made and not when it is run.

Source: commons/data/sql/physical/refs.ts

1 of 4 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

RefErrortypeno test imports it
type RefError =
  | { readonly kind: "unknown-table"; readonly name: string }
  | { readonly kind: "unknown-column"; readonly table: string; readonly column: string }
  | { readonly kind: "names"; readonly errors: readonly PhysicalError[] };

What is wrong with a name in a text.

refsOffunction
function refsOf(schema: LogicalSchema, dialect: Dialect, naming: Naming, inSchema?: string | undefined, relation?: ((name: string) => string | undefined) | undefined): RefsKit

The references of a schema.

ParameterWhat it is
schemathe logical schema
dialectthe dialect
namingthe case styles
inSchemathe schema the tables are in, as bind was given it
relationwhat the caller gives for a name that is not a table of the schema (a model of its own), or nothing

Returns: the references and what they found wrong

Imported by 2 tests of the run (2 passed, 0 failed): the library's results

Refsinterfaceno test imports it
interface Refs

The names of a schema, for the text of a person.

MemberTypeWhat it is
table(name: string) => stringThe reference to a table, written and qualified, by the words of its name; or what the caller's relation gives for the name.
column(table: string, column: string) => stringA column of a table, written and quoted, by the words of both names.
own(name: string) => stringA name written by the schema's naming for a table of the caller's own: with the schema's words added where the dialect has no schemas.
RefsKitinterfaceno test imports it
interface RefsKit

The names a text asked for, and what was wrong with them.

MemberTypeWhat it is
refsRefs
errors() => readonly RefError[]
used() => readonly { readonly name: string; readonly via: "relation" | "schema"; }[]The tables asked for, once each, in the order first asked, with where each came from.

Titles, headings, exports, tables, columns and requirements. Esc closes.