Generate malli schemas from an applied PostgreSQL schema, and use them.
Generation (needs psql): generate!, stale. Application side (files on the classpath as pgmalli/<schema>.edn): registry, unrendered, columns, transformer, dataset-schema, dataset-generator.
The config (pgmalli.impl.generate), the generated file layout and the fact vocabulary (pgmalli.impl.pattern) are the stable contract; pgmalli.impl.* may change without notice.
Generate malli schemas from an applied PostgreSQL schema, and use them. Generation (needs psql): generate!, stale. Application side (files on the classpath as pgmalli/<schema>.edn): registry, unrendered, columns, transformer, dataset-schema, dataset-generator. The config (pgmalli.impl.generate), the generated file layout and the fact vocabulary (pgmalli.impl.pattern) are the stable contract; pgmalli.impl.* may change without notice.
(as-read registry name opts)The [:map ...] of a row as a JDBC result builder returns it. Options: :qualified? (keys as :table/column, next.jdbc's as-maps), :kebab? (keys and table names in kebab-case), :nil-columns :absent (NULL columns missing, next.jdbc.optional), :time :instant (read-as-instant: timestamps as Instants, dates stay java.sql.Date, so inst?) or :local (read-as-local: timestamptz as LocalDateTime).
The [:map ...] of a row as a JDBC result builder returns it. Options: :qualified? (keys as :table/column, next.jdbc's as-maps), :kebab? (keys and table names in kebab-case), :nil-columns :absent (NULL columns missing, next.jdbc.optional), :time :instant (read-as-instant: timestamps as Instants, dates stay java.sql.Date, so inst?) or :local (read-as-local: timestamptz as LocalDateTime).
(column registry name col)The schema of one column of a row or insert schema, as data, [:maybe ...] included.
The schema of one column of a row or insert schema, as data, [:maybe ...] included.
(columns registry name)The [:map ...] of a row or insert schema, without the table-level constraints.
The [:map ...] of a row or insert schema, without the table-level constraints.
(dataset-generator registry)(dataset-generator registry opts)test.check generator of datasets satisfying dataset-schema. Options: :rows wanted per table (default 5), :except tables ("schema.table") to leave out (no kept table may reference them). Tables that came out short are listed in the dataset's metadata under :pgmalli/short.
test.check generator of datasets satisfying dataset-schema. Options: :rows wanted per table
(default 5), :except tables ("schema.table") to leave out (no kept table may reference them).
Tables that came out short are listed in the dataset's metadata under :pgmalli/short.(dataset-schema registry)Schema for {"schema.table" [row ...]} datasets: rows, primary keys, unique constraints and foreign keys checked across the registry's tables.
Schema for {"schema.table" [row ...]} datasets: rows, primary keys, unique constraints and
foreign keys checked across the registry's tables.(generate! config)Writes the generated file for every schema in the config. Returns {schema path}.
Writes the generated file for every schema in the config. Returns {schema path}.
(non-null schema)A column schema without its [:maybe ...]: what a value must be when it is not NULL.
A column schema without its [:maybe ...]: what a value must be when it is not NULL.
(portable registry name)The named schema as data malli's default registry reads (plus malli.experimental.time): the schema's own types inlined, pgmalli's types as their malli counterparts, generation hints dropped, the CHECKs only pgmalli evaluates left out. For :malli/schema metadata and other places the registry cannot follow.
The named schema as data malli's default registry reads (plus malli.experimental.time): the schema's own types inlined, pgmalli's types as their malli counterparts, generation hints dropped, the CHECKs only pgmalli evaluates left out. For :malli/schema metadata and other places the registry cannot follow.
(registry & schemas)malli registry holding the generated schemas of the named schemas (read from the classpath; generated data maps are accepted too), insert schemas derived from them, plus malli's defaults, malli.util and malli.experimental.time.
malli registry holding the generated schemas of the named schemas (read from the classpath; generated data maps are accepted too), insert schemas derived from them, plus malli's defaults, malli.util and malli.experimental.time.
(stale config){schema [only-in-file only-in-db]} for schemas whose file differs from what the database yields now; nil when everything matches. A missing file counts as entirely stale.
{schema [only-in-file only-in-db]} for schemas whose file differs from what the database
yields now; nil when everything matches. A missing file counts as entirely stale.(transformer)(transformer opts)malli transformer decoding JDBC and string values into the registry's types. Instants and java.util.Dates that land in date or timestamp (without time zone) columns are read in :zone, default the JVM's; JSON text in json and jsonb columns is parsed.
malli transformer decoding JDBC and string values into the registry's types. Instants and java.util.Dates that land in date or timestamp (without time zone) columns are read in :zone, default the JVM's; JSON text in json and jsonb columns is parsed.
(unrendered schema-name)Facts of a schema that have no malli rendering.
Facts of a schema that have no malli rendering.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |