sqlode/codegen/common
Values
pub fn catalog_scalar_types(
catalog: model.Catalog,
) -> List(model.ScalarType)
Collect all scalar types from catalog tables.
pub fn custom_type_imports(
scalar_types: List(model.ScalarType),
) -> List(String)
Collect import statements for module-qualified custom types from scalar types.
pub fn escape_string(input: String) -> String
pub fn gleam_fn(
name: String,
params: String,
return_type: String,
body: String,
) -> String
Render a Gleam function declaration as a single string.
gleam_fn(“double”, “x: Int”, “Int”, “x * 2”) → “pub fn double(x: Int) -> Int { x * 2 }”
pub fn gleam_type(name: String, body: String) -> String
Render a single-constructor Gleam type declaration.
gleam_type(“UserId”, “Int”) → “pub type UserId { UserId(Int) }”
pub fn has_slices(params: List(model.QueryParam)) -> Bool
pub fn out_to_module_path(out: String) -> String
Derive the Gleam module path from the output directory. Strips the “src/” prefix so imports match the actual file location. e.g. “src/db” -> “db”, “/abs/path/src/db” -> “db”
pub fn param_scalar_types(
queries: List(model.AnalyzedQuery),
) -> List(model.ScalarType)
Collect all scalar types from query params.
pub fn queries_have_enum_params(
queries: List(model.AnalyzedQuery),
) -> Bool
pub fn queries_have_enums(
queries: List(model.AnalyzedQuery),
) -> Bool
pub fn queries_have_slices(
queries: List(model.AnalyzedQuery),
) -> Bool
pub fn result_scalar_types(
queries: List(model.AnalyzedQuery),
) -> List(model.ScalarType)
Collect all scalar types from query result columns.
pub fn runtime_import_path(gleam: model.GleamOutput) -> String
Import path used by generated modules for the sqlode runtime. When
gleam.vendor_runtime is enabled, the runtime source is written
into <out>/runtime.gleam and the generated code points at that
local copy (e.g. db/runtime). Otherwise the shared
sqlode/runtime dependency is used.