Expand description
Convert SQL identifiers to Rust-idiomatic forms.
The primary entry point is singularize, which turns a (potentially
snake_case) plural noun into its singular form so that table names like
users produce User instead of Users. Rust ORMs (Diesel, SeaORM) and
the broader ActiveRecord-style world expect singular row structs.
Functions§
- singularize
- Singularize a snake_case identifier by transforming only the trailing
word:
user_accounts→user_account,news_posts→news_post. - singularize_
word - Singularize a single English word. Conservative: when in doubt the word is returned unchanged so we never butcher a perfectly good singular noun.