IntrospectOptionsinterfaceno test imports itinterface IntrospectOptionsWhat introspection may be given.
| Member | Type | What it is |
|---|---|---|
functions? | readonly FunctionSpec[] | The functions of the function relation. |
Introspection (commons lang-sql 0008-sql-introspect): SQL over the syntax tree. introspect parses a text and gives an Introspection whose query answers a small SQL over the relations of the parse (statements, nodes, attributes, ancestors, tokens, comments, names, calls, parameters, common table expressions, diagnostics and the language of the dialect), and whose diagnostics are the errors of the parse and the rows of the rules, which are queries too. A helper of aide: it runs its queries on the engine of aide/relational.
const i = introspect("DELETE FROM t; SELECT * FROM u", postgres);
i.query("SELECT name, access FROM table_ref"); // t write, u read
i.diagnostics().map((d) => d.code); // ["delete-without-where", "select-star"]Spec: 0008-sql-introspect FR-001, FR-004, FR-007
IntrospectOptionsinterfaceno test imports itinterface IntrospectOptionsWhat introspection may be given.
| Member | Type | What it is |
|---|---|---|
functions? | readonly FunctionSpec[] | The functions of the function relation. |
Diagnosticinterfaceno test imports itinterface DiagnosticA diagnostic: where, how bad, and why.
| Member | Type | What it is |
|---|---|---|
severity | "error" | "info" | "warning" | |
code | string | |
message | string | |
start | number | |
end | number | |
rule | string | |
node | number | The id of the node in the node relation, 0 for a parse error. |
Introspectioninterfaceno test imports itinterface IntrospectionThe introspection of a parse.
| Member | Type | What it is |
|---|---|---|
parsed | Parsed | |
query | (sql: string, params?: readonly Value[] | undefined) => Result<Table, QueryError> | Answers a query over the relations. |
tables | () => Readonly<Record<string, readonly string[]>> | The relations and their columns. |
built | () => readonly string[] | The relations built so far. |
diagnostics | () => readonly Diagnostic[] | The errors of the parse and the findings of the rules. |
addRule | (rule: Rule) => Result<Rule, QueryError> | Adds a rule; an error value where its query does not run or has no node column. |
introspectfunctionfunction introspect(text: string, dialect: Dialect, options?: IntrospectOptions): IntrospectionReads a text in a dialect and gives its introspection.