Skip to main content

Table

Derive Macro Table 

Source
#[derive(Table)]
{
    // Attributes available to this derive:
    #[hyperdb]
}
Expand description

Derives hyperdb_api::Table for a struct.

Generates impl Table with NAME and CREATE_SQL consts. When the compile-time cargo feature is enabled and #[hyperdb(register)] is present, also registers the table with the compile-time validator.

§Attributes (struct level)

  • #[hyperdb(table = "name")] — override the SQL table name (default: lower_snake_case of the struct ident).
  • #[hyperdb(register)] — register for compile-time query_as! validation.

§Attributes (field level)

  • #[hyperdb(primary_key)] — marks the column as NOT NULL (always true for non-Option fields, but documents intent).
  • #[hyperdb(rename = "col")] — use a different SQL column name.