IF Commons GitHub

logical/query

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

Questions of the repository in SQL (commons repoctl 0012-repoctl-query): the libraries, their specifications and the requirements each specification keeps, read from the manifests and the tables of the spec kits and 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 texts it reads.

import { askRepository } from "./query.ts";
// askRepository(sources, "SELECT library, count(*) AS n FROM requirements WHERE mechanism = 'none' GROUP BY library");

Source: commons/repoctl/src/logical/query.ts

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

logical.RepositorySourcetypeno test imports it
type RepositorySource = { readonly library: LibraryInfo; readonly registry: string | undefined; readonly enforcement: string | undefined };

What is read of one library: its manifest facts and the texts of its two tables (registry.tsv, enforcement.tsv), or none where it has no kit.

logical.RepositoryQueryOptionstypeno test imports it
type RepositoryQueryOptions = { readonly limit?: number; readonly params?: readonly Value[] };

What may be given to a question.

logical.RepositoryAnswertypeno test imports it
type RepositoryAnswer = { readonly columns: readonly string[]; readonly rows: readonly (readonly Value[])[]; readonly truncated: boolean };

What a question gives.

logical.repositoryCatalogfunctionno test imports it
function repositoryCatalog(): Catalog

The catalog of the relations.

logical.repositoryRelationsfunctionno test imports it
function repositoryRelations(sources: readonly RepositorySource[]): Readonly<Record<string, Table>>

The relations of the sources: a header line of a table is left out, a line that is not a row is left out.

logical.askRepositoryfunctionno test imports it
function askRepository(sources: readonly RepositorySource[], sql: string, options?: RepositoryQueryOptions): Result<RepositoryAnswer, string>

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

RepositorySourcetype
type RepositorySource = { readonly library: LibraryInfo; readonly registry: string | undefined; readonly enforcement: string | undefined };

What is read of one library: its manifest facts and the texts of its two tables (registry.tsv, enforcement.tsv), or none where it has no kit.

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

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

What may be given to a question.

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

What a question gives.

repositoryCatalogfunctionno test imports it
function repositoryCatalog(): Catalog

The catalog of the relations.

repositoryRelationsfunction
function repositoryRelations(sources: readonly RepositorySource[]): Readonly<Record<string, Table>>

The relations of the sources: a header line of a table is left out, a line that is not a row is left out.

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

askRepositoryfunction
function askRepository(sources: readonly RepositorySource[], sql: string, options?: RepositoryQueryOptions): Result<RepositoryAnswer, string>

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

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

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