Skip to main content

Module naming

Module naming 

Source
Expand description

The naming convention: how a declaration becomes a physical name.

Applied during lowering, once, so no downstream crate ever re-derives a table or column name. @map / @@map override everything here.

The pluraliser is deliberately dumb. English is not tractable, and a clever implementation would be wrong in unpredictable places; a documented, boring one is wrong in predictable places, and @@map("...") is the escape hatch.

Functionsยง

column_name
The column name for a field with no @map.
enum_type_name
The database type name for an enum with no @@map.
foreign_key_name
The derived name of a foreign key constraint over columns on table.
index_name
The derived name of an index over columns on table.
is_rust_keyword
Whether a field name needs r# escaping in generated Rust.
pluralize
Pluralises a lowercase English noun.
snake_case
Converts PascalCase or camelCase to snake_case.
table_name
The table name for a model with no @@map.
unique_name
The derived name of a unique constraint over columns on table.