Skip to main content

Crate scythe_codegen

Crate scythe_codegen 

Source

Re-exports§

pub use backend_trait::CodegenBackend;
pub use backend_trait::RbsEnumInfo;
pub use backend_trait::RbsGenerationContext;
pub use backend_trait::RbsQueryInfo;
pub use backend_trait::ResolvedColumn;
pub use backend_trait::ResolvedParam;
pub use backends::get_backend;
pub use overrides::TypeOverride;

Modules§

backend_options
backend_trait
backends
overrides
provenance
The provenance header line every generated file carries, and the exact byte ordering it sits in.
resolve
sql_literal
Escape SQL text for safe splicing into a target-language string literal.
validation

Structs§

GeneratedCode
NestedStructDef
One rendered nested-aggregate struct definition, paired with the name it declares so file writers can deduplicate.
NestedStructDegradation
One nested-aggregate column degrade_unsupported_nested_structs rewrote to a scalar JSON fallback because backend could not construct a real struct for it. See GeneratedCode::degraded_nested_structs for why this is surfaced at all rather than left as an internal rewrite (GH #147).

Functions§

degrade_unsupported_nested_structs
generate
Backward-compatible: generate code using the default sqlx backend.
generate_single_enum_def
Backward-compatible: generate a single enum definition (sqlx backend). Uses the manifest directly for backward compatibility with existing callers.
generate_single_enum_def_with_backend
Generate a single enum definition using a specific backend.
generate_with_backend
Generate code using a specific backend.
generate_with_backend_and_overrides
Generate code using a specific backend with type overrides.
generate_with_backend_and_overrides_and_nested_composites
Generate code while promoting the named composites to their nested-capable form.
get_manifest_for_backend
Get the manifest for a backend. Defaults to PostgreSQL engine.
load_or_default_manifest
Backward-compatible: load the default sqlx manifest.
model_struct_name
The type name a SELECT * model is declared under and referenced by.
nested_type_is_emitted
Whether sql_name is reachable from a nested-aggregate struct the backend actually emitted a definition for.
singularize
Simple singularization: remove trailing ‘s’.

Type Aliases§

DegradedNestedStructs
Degradation pass for nested-aggregate columns (json_agg(o.*), row_to_json(u.*)). Must run before resolve::resolve_columns – every caller that resolves AnalyzedColumns into a backend’s types needs this, not just generate_with_backend_and_overrides: scythe-cli’s RBS signature generation (generate_rbs_if_supported) calls resolve::resolve_columns directly on a second, independent path, so it must run this pass too or it silently bypasses the byte-identity guarantee for any backend that hasn’t opted in.