Skip to main content

Module registry

Module registry 

Source
Expand description

Table and struct registry for compile-time validation.

derive(Table) #[hyperdb(register)] calls into this registry at macro expansion time to record:

  • The SQL CREATE TABLE statement for the table (for lazy seeding).
  • The struct’s field-name list (for the name-subset diff in validate.rs).

Tables are seeded into the CompileTimeDb lazily: only when a query_as! dry-run returns SQLSTATE 42P01 (undefined_table) do we seed the relevant table and retry. This handles cross-file macro expansion ordering without requiring a client-side SQL parser.

Structs§

Registry
The public Registry type — a thin newtype that provides the seeding interface against a live CompileTimeDb. Created from a lock guard by validate_query_as.
TableEntry
Information about a registered table derived from #[derive(Table)].

Functions§

contains
Returns true if the SQL table name is known to the registry.
get_by_struct
Look up a registered entry by Rust struct ident. Returns (table_name, entry) so callers have the SQL name for seeding.
get_by_table
Look up a registered entry by SQL table name.
register
Register a table and its associated struct field list.
registered_names
All registered table names (for diagnostics).