Skip to main content

Module codegen

Module codegen 

Source

Modules§

composite_gen
crud_gen
domain_gen
entity_parser
enum_gen
identifiers
struct_gen

Structs§

GeneratedFile
A generated code file with its content and required imports.

Functions§

build_module_name
Build a module name, prefixing with schema only when the name collides (same table name exists in multiple schemas).
detect_tab_spaces
Detect tab_spaces from rustfmt.toml or .rustfmt.toml by walking up from start_dir. Returns 4 (rustfmt default) if no config is found.
format_tokens_with_imports
format_tokens_with_imports_and_tab_spaces
generate
Generate all code for a given schema.
generate_with_domain_style
Same as generate but lets the caller pick how Postgres domains are rendered (alias vs newtype).
imports_for_derives
Returns the imports needed for well-known extra derives.
is_default_schema
Returns true if the schema is a well-known default (public, main, dbo).
is_rust_keyword
Returns true if the given name is a Rust reserved keyword.
normalize_module_name
Normalize a table name for use as a Rust module/filename: replace multiple consecutive underscores with a single one.
required_pg_search_path
Compute the schemas that must appear in PostgreSQL’s search_path for the generated code to resolve every emitted unqualified type_name.
rust_type_name_for
Compute the Rust identifier for an enum / composite / domain.
type_name_has_cross_schema_collision
True when the SQL name is declared by enums / composites / domains living in more than one schema.