IF Commons GitHub

query

Written to: 3 requirements: 3 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-mizan-query FR-001, 0002-mizan-query FR-002, 0002-mizan-query FR-003

Questions of the trace in SQL (commons mizan 0002-mizan-query): the findings of the trace check judged against a baseline, the baseline's keys and the specifications with their requirements, made into relations, and a read-only SQL answered over them with the SQL language library (its guard judges that the text is one read and binds it to the catalog, its engine answers). Pure: it is given the findings, the baseline and the specifications it reads.

import { queryTrace } from "@intellectual-frontiers/mizan/query";
// queryTrace(input, "SELECT rule, count(*) AS n FROM findings WHERE status = 'fresh' GROUP BY rule ORDER BY n DESC");

Source: commons/mizan/src/query.ts

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

TraceRecordstype
type TraceRecords = { readonly findings: readonly Keyed[]; readonly baseline: readonly string[]; readonly specs: readonly Spec[] };

What a question is about: the findings of a check, the keys of its baseline and the specifications.

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

QueryOptionstypeno test imports it
type QueryOptions = { readonly limit?: number; readonly params?: readonly Value[] };

What may be given to a question.

Answertypeno test imports it
type Answer = { readonly columns: readonly string[]; readonly rows: readonly (readonly Value[])[]; readonly truncated: boolean };

What a question gives.

traceCatalogfunction
function traceCatalog(): Catalog

The catalog of the relations.

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

traceRelationsfunction
function traceRelations(records: TraceRecords): Readonly<Record<string, Table>>

The relations of the records: a finding is fresh (the baseline does not hold it) or held; a key of the baseline is held (a finding has it) or stale (none has).

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

queryTracefunction
function queryTrace(records: TraceRecords, sql: string, options?: QueryOptions): Result<Answer, string>

The answer to one read-only question over the trace, or why it is refused (with its place) or cannot be answered.

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

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