astsqlconstno test imports itconst astsql: DialectThe dialect of the queries: the common ground.
The engine of introspection (commons lang-sql 0008-sql-introspect FR-005, FR-006; 0010-aide FR-010): a small evaluator of the common ground of SQL over relations held in memory, so that a question about a tree is a query. It reads the query with this library's own parser, with the logic of SQL (null where a value is not known), and says in one sentence what it does not have. It sits behind Engine, which does not name the tree, and takes its relations from a Provider, so that any rows (a file tree, a list of checks, the tables of a machine) can be asked in SQL; it is read-only, and a statement that is not a query is an error value.
Spec: 0008-sql-introspect FR-005, FR-006
astsqlconstno test imports itconst astsql: DialectThe dialect of the queries: the common ground.
createEnginefunctionfunction createEngine(tables: Provider, functions?: ReadonlyMap<string, ScalarFunction>, options?: EngineOptions): EngineAn engine over relations that a function gives by name (the relations are built when a query names them).
Engineinterfaceno test imports itinterface EngineSomething that answers a query.
| Member | Type | What it is |
|---|---|---|
run | (sql: string, params?: readonly Value[] | undefined) => Result<Table, QueryError> |
QueryErrorinterfaceno test imports itinterface QueryErrorWhat is wrong with a query, in one sentence.
| Member | Type | What it is |
|---|---|---|
message | string |
Rowstypeno test imports ittype Rows = Table;What a query gives.
ScalarFunctiontypeno test imports ittype ScalarFunction = (args: readonly Value[]) => Value;The functions a query may call besides the built-in ones of the engine.
Tableinterfaceno test imports itinterface TableA relation: named columns and rows of values.
| Member | Type | What it is |
|---|---|---|
columns | readonly string[] | |
rows | readonly (readonly Value[])[] |
Providertypeno test imports ittype Provider = (name: string) => Table | undefined;Where relations come from: a function that gives the relation of a name, or undefined for a name it has not; it is asked when a query names the relation, so a provider may build it then.
providerOffunctionfunction providerOf(tables: Readonly<Record<string, Table>>): ProviderA provider of the relations of a record, found without regard to case.
EngineOptionsinterfaceno test imports itinterface EngineOptionsWhat an engine may be given besides its relations and functions.
| Member | Type | What it is |
|---|---|---|
now? | (() => Date) | The clock CURRENT_DATE and the other current values are read from, once for each statement (the system clock where none is given). |