Minimal SQLite key-value store for OCaml
1(** SQLite CREATE TABLE AST types and column classification. *)
2
3type col_token =
4 | Tok_word of string
5 | Tok_number of string
6 | Tok_parens of col_token list
7
8type table_constraint =
9 | Tbl_unique of string list
10 | Tbl_primary_key of string list
11 | Tbl_other
12
13type column_def = {
14 name : string;
15 affinity : string;
16 is_rowid_alias : bool;
17 has_unique : bool;
18 has_primary_key : bool;
19}
20
21type create_table = {
22 tbl_name : string;
23 columns : column_def list;
24 table_constraints : table_constraint list;
25}
26
27val classify_column : string -> col_token list -> column_def
28(** [classify_column name tokens] splits [tokens] into type affinity and
29 constraints, returning a column definition. *)