pub fn model_struct_name(table_name: &str, naming: &NamingConfig) -> StringExpand description
The type name a SELECT * model is declared under and referenced by.
The single source of truth for #164. Both sides of that defect now call
this: [determine_struct_name] below, which decides what the generated
query function references, and CodegenBackend::generate_model_struct,
which decides what gets declared. There is no longer a second derivation
for them to drift apart from.
Deliberately does not apply row_struct_name’s row_suffix. The
suffix exists to keep a per-query row type (GetActiveUsersRow) from
colliding with the query function that returns it; a table model is not
a per-query type, and suffixing it would make SELECT * FROM users
declare UserRow — the very name a query named User already claims.
table_name reaches here from analyzed.source_table, which is not
guaranteed to already be an identifier: SELECT * FROM app.widgets
carries the schema-qualifying . straight through
detect_select_star_source (unlike a query’s @name, which the parser
already validates as letters/digits/underscore only), and apply_case
alone does not remove it – the same shape as enum_type_name’s #136,
just for a model struct instead of an enum. Routed through the same
sanitize_for_identifier before singularizing and casing, so the .
becomes _ before either runs.