Skip to content

v4.4.0 — multi-dialect support

Latest

Choose a tag to compare

@juggle73 juggle73 released this 16 Jun 11:05

norm now targets PostgreSQL (default), SQLite and MySQL — plus the compatible MariaDB, CockroachDB and YugabyteDB — through a Dialect abstraction on Config.

Highlights

  • Config.Dialect selects bind placeholders ($N vs ?), RETURNING/upsert syntax and default column types. PostgreSQL stays the default.
  • migrate and gen support SQLite and MySQL: DDL generation, MODIFY COLUMN, and information_schema / PRAGMA introspection.
  • Opt-in Config.QuoteIdentifiers quotes generated table/column names, so reserved words (e.g. a table named order) work.
  • Dialect-aware JSON marshaling of map/slice fields; on PostgreSQL slices map to native array columns (text[], bigint[]), and gen resolves the precise element type.
  • Compatible dialects: MariaDB reuses MySQL, CockroachDB/YugabyteDB reuse PostgreSQL.

Testing & examples

  • Live integration tests for SQLite (pure-Go driver) and, behind Docker, MySQL and PostgreSQL.
  • New examples: sqlite, mysql, pg_arrays, compatible_dialects.

Compatibility

Fully backward compatible with v4.3.0: no exported signature changed, and the default PostgreSQL output is byte-for-byte identical. New behavior is opt-in via Config.Dialect / Config.QuoteIdentifiers.

Full changelog: v4.3.0...v4.4.0