Skip to main content

Module naming

Module naming 

Source
Expand description

Naming conventions shared across generators.

Centralised so every crate agrees on how a model name maps to a module name, a table name, etc. Kept dependency-free (no heavy inflection crate) for the MVP.

Functions§

model_name
Recover a model’s PascalCase struct name from its module/table name: users -> User, blog_posts -> BlogPost.
pascal_case
Convert a snake_case identifier back to PascalCase: blog_post -> BlogPost.
pluralize
Naive pluralisation good enough for table names in the MVP.
singularize
Singularize a table name, inverting pluralize for the forms Gize produces: users -> user, categories -> category, boxes -> box.
snake_case
Convert a PascalCase or arbitrary identifier to snake_case.
table_name
The table name for a model (snake_case + pluralized): User -> users.