glimr/db/gen

Database Code Generator

Querying a database in Gleam requires writing types, decoders, and wrapper functions for every model — all of which must stay in sync with the schema and SQL files. This module automates that by scanning model directories, parsing schemas and .sql files, and emitting fully-typed repository modules so schema changes only require re- running the generator.

Values

pub fn run(
  name: String,
  model_filter: option.Option(List(String)),
  verbose: Bool,
) -> Nil

Pass a connection name and optionally a list of specific models to regenerate. Without a filter, every model in the connection gets processed — the filter exists so you can regenerate just the model you’re working on without waiting for all of them.

Search Document