Module vtab_argparse

Source
Expand description

Opininated parsing for SQLite virtual table constructor arguments.

A “constructor” comes from the CREATE VIRTUAL TABLE statement of a virtual table, like:

CREATE VIRTUAL TABLE xxx USING custom_vtab(
  mode="production",
  state=null,
  name TEXT,
  age INTEGER,
  progress REAL
)

sqlite_loadable passes down the arguments between custom_vtab(...) as a vector of strings within VTabArguments.arguments, where each comma-seperated argument is its own element in the vector.

Virtual table statements are allowed to parse these arguments however they want, and this module is one opinionated option, loosely based on FTS5 virtual tables.

Structs§

ColumnDeclaration
A column declaration that defines a single column. Example: "name text" would parse to a column with the name "name" and declared type of "text".
ConfigOption
A parsed configuration option, that always contain a key/value pair. These can be used as “table-options” to configure special behavior or settings for the virtual table implementation. Example: the tokenize and prefix config options on FTS5 virtual tables https://www.sqlite.org/fts5.html#fts5_table_creation_and_initialization

Enums§

Argument
A successfully parsed Argument from a virtual table constructor. A single constructor can have multiple arguments, this struct only represents a single one.
ConfigOptionValue
Possible options for the “values” of configuration options.

Functions§

arg_is_column_declaration
parse_argument
Given a raw argument, returns a parsed Argument. Should already by comma (?) delimited, typically sourced from VTabArguments.