Changelog
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[4.1.0] - 2026-06-06
Added
-
select.not_where: sets aNotWhereclause on a SELECT query, allowing negated WHERE conditions withANDsemantics. -
select.not_having: sets aNotWhereclause on theHAVINGportion of a SELECT query, for negated aggregation filters. -
delete.not_where: sets aNotWhereclause on a DELETE query, allowing negated WHERE conditions withANDsemantics. -
update.not_where: sets aNotWhereclause on an UPDATE query, allowing negated WHERE conditions withANDsemantics.
Changed
-
Updated XOR documentation across
select,update, anddeletemodules to clarify that Cake implementsxorusing a customOR / AND / NOTexpansion on all four adapters (🐘PostgreSQL, 🪶SQLite, 🦭MariaDB, 🐬MySQL) rather than native XOR. Entries now referencewhere.xor_parityfor odd-parity XOR use cases. -
Updated join documentation in both
join.gleamandinternal/read_query.gleamto explain how to make joins exclusive using additionalWHEREfilters (e.g.,LEFT JOIN+WHERE b.key IS NULLfor exclusive left joins).
Documentation
- Improved module documentation for builder APIs.
- Added mermaid.js bundle (
assets/mermaid.bundle.js) for rendering diagrams in documentation. - Updated README and other documentation files.
[4.0.0] - 2026-05-30
Breaking changes
-
[BREAKING]
where.xorsemantics unified to “exactly one” across all dialects. Previously, 🦭MariaDB and 🐬MySQL used the engines’ nativeXORoperator, which evaluates left-to-right and returnsTRUEwhen an odd number of operands are true (odd-parity semantics). 🐘PostgreSQL and 🪶SQLite emulatedxoras exactly one condition being true via a combinatorial expansion. These two semantics are equivalent for two operands but diverge for three or more.🦭MariaDB/🐬MySQL now use the same combinatorial “exactly one” expansion as 🐘PostgreSQL/🪶SQLite, making
where.xorconsistent across all four dialects. Any code that relied on the native-XOR(odd-parity) behaviour ofxoron 🦭MariaDB or 🐬MySQL with three or more conditions will observe different query results after upgrading. -
[BREAKING]
wheremodule parameter labels renamed. The functionswhere.float,where.int,where.string, andwhere.datehad their external parameter labels renamed fromvtovalue. Any call site using named-argument syntax (e.g.where.float(v: 1.0)) must be updated towhere.float(value: 1.0). Positional call sites are unaffected.Note: Similar internal variable name changes were made in
insert,update, andfragmentmodules for consistency (e.g.,vl→value,col→column,str→string,prms→params), but these do not affect external APIs since the external labels remained the same.
Added
-
where.xor_parity: a new function implementing odd-parity XOR (returnsTRUEwhen an odd number of conditions are true). On 🦭MariaDB and 🐬MySQL it delegates to the engines’ native left-to-rightXORoperator; on 🐘PostgreSQL it uses((cond)::int + …) % 2 = 1; on 🪶SQLite it uses the same arithmetic without casts.NULLpropagates through the expression on all four dialects, matching nativeXORbehaviour. Preferxor_parityoverxorwhen targeting three or more conditions and odd-count semantics are required. -
where.bool: creates aWhereValuefrom a runtimeBoolvariable. Complements the existingwhere.true()andwhere.false()constants. -
where.neq,where.neq_any_query,where.neq_all_query: not-equal comparison functions, emitting<>,<> ANY, and<> ALLrespectively.neq_any_queryandneq_all_queryare not supported by 🪶SQLite. -
fragment.date,insert.date,update.set_date: convenience constructors forcalendar.Datevalues, bringing date support in line with the other param-creating helpers across all builder modules.
Fixed
-
insert.on_constraint_conflict_ignoreandinsert.on_constraint_conflict_updateemitted wrong SQL: queries usingInsertConflictTargetConstraintproducedON CONFLICT (constraint_name)instead of the correctON CONFLICT ON CONSTRAINT constraint_name. The generated SQL was invalid and rejected by the database. -
Epilog silently discarded in write queries when a single-line comment is set: in
INSERT,UPDATE, andDELETEquery builders,comment_applywas called beforeepilog_apply. When the comment used the--single-line style, the SQL parser treated everything after--on the same line — including the epilog — as a comment, silently dropping it. The order is now… <epilog> -- <comment>, consistent with the existingSELECTandCOMBINEDbuilders. -
INSERTmodifier placed after the column list instead of beforeINTO: setting a modifier viainsert.modifierproduced invalid SQL such asINSERT INTO cats (name) OR REPLACE VALUES ($1). The modifier is now emitted betweenINSERTandINTOon all four dialects, giving the correct formINSERT OR REPLACE INTO cats (name) VALUES ($1). The fix also covers the 🦭MariaDB / 🐬MySQLINSERT IGNOREfallback path, where a user-supplied priority modifier (e.g.LOW_PRIORITY) is now correctly placed beforeIGNORE INTO:INSERT LOW_PRIORITY IGNORE INTO …. -
select.order_by_asc_nulls_last,select.replace_order_by_asc_nulls_last,select.order_by_desc_nulls_last,select.replace_order_by_desc_nulls_lastemittedNULLS FIRSTinstead ofNULLS LAST: all four functions passed the wrongOrderByDirectionvariant internally, causing e.g.ORDER BY col ASC NULLS FIRSTto be emitted whenNULLS LASTwas requested. The equivalent functions incombinedwere unaffected. -
Fixed examples to run without tinkering.
Removed
- Documentation references to
gmysqlhave been removed as the package appears unmaintained. This is not a breaking change —gmysqlwas never a dependency, only mentioned as an adapter option in documentation. Users of older Cake versions may still be able to use it.
[3.0.0] - 2026-04-29
-
Added support for fragments in Inserts and Updates. Thanks to @qwexvf. This adds constructors to the public
InsertValue/UpdateSetunion types, which can break downstream compilation for exhaustive pattern matches.This is MOST LIKELY not a breaking change, if only the builder functions have been used to construct inserts.
[2.2.2] - 2026-04-26
- Update Cake’s internal query builder to remove
let assertusage in prepared fragment building and unreachablepanic.
[2.2.1] - 2026-04-18
- Make compatible with recent gleam stdlib versions.
[2.2.0] - 2025-10-31
- Add
Datesupport based ongleam_time’scalendar.Date.
[2.1.3] - 2025-07-28
- Fix demos to use recent dynamic decoders and library versions.
[2.1.2] - 2025-07-09
- Utilize
pog ~> 4.0.0dependency in tests.
[2.1.1] - 2025-04-02
- Update deps, including latest stdlib.
- Only support Gleam 1.9.0+.
- BREAKING spelling fix: Renamed
InsertConfictTargettoInsertConflictTarget. - Relaxed type arg.
[2.1.0] - 2024-11-14
- Added convenience functions to
selectmodule to select columns by col names:colsreplace_select_colscolreplace_select_col
- Replaced dev/test and adapter target
gleam_pgowithpgodependency. - Updated demos.
[2.0.2] - 2024-11-03
- [BREAKING]: Renamed
select.offsetfunction’soffstlabel tooffset - Updated test runner to target lowest and highest Erlang and Gleam
versions supported:
- Lowest is at the moment Erlang/OTP 26 and Gleam 1.4
- Updated dependencies
- Fixed typos
[2.0.1] - 2024-10-19
- Improved Readme
[2.0.0] - 2024-10-19
- Breaking changes:
- Renamed
cake.cake_read_querytocake.to_read_query - Renamed
cake.cake_write_querytocake.to_write_query - Renamed
cake.cake_query_to_prepared_statementtocake.to_prepared_statement
- Renamed
[1.1.2] - 2024-08-30
- Consistent dialect function names across all 4 RDBMS, fixed/renamed
functions:
postgres_dialect/read_cake_query_to_prepared_statement=>postgres_dialect/cake_query_to_prepared_statementpostgres_dialect/query_to_prepared_statement=>postgres_dialect/read_query_to_prepared_statementsqlite_dialect/read_cake_query_to_prepared_statement=>sqlite_dialect/cake_query_to_prepared_statementsqlite_dialect/query_to_prepared_statement=>sqlite_dialect/read_query_to_prepared_statement- Note that while this a breaking change, the compiler will complain and the fix is trivial.
[1.1.1] - 2024-08-09
- Fix gleam min version to 1.3.0 to enable
gleam add cake@1to work.
[1.1.0] - 2024-08-09
- Added
join.left_lateralandjoin.inner_lateralandjoin.cross_lateralsupportLATERAL JOINs available on 🐘PostgreSQL 9.3+ and recent 🐬MySQL versions. NOTICE: You may also useLATERALliterally to prefix table names inFROMclauses with multiple tables.
[1.0.1] - 2024-07-26
- Breaking but very small bug fix change:
insert.on_columns_conflict_ignorespecifies its column list via thecolumnslabel instead ofcolumnlabel.
[1.0.0] - 2024-07-24
- 1.0.0 stable release
[1.0.0-rc.0] - 2024-07-23
insert.on_columns_conflict_updatechange thecolumnlabel tocolumns.- Added
UPDATEdemo. - Added
INSERT ON CONFLICT UPDATEdemo. - Added
SELECTwithJOINdemo. - Added a demo using
FragmentandPreparedStatement. - Added more public utility functions to the
fragmentmodule. - Removed glacier dev-dependency to speed up compilation.
- Moved demo apps into sub dir.
- Fixed a few path bugs in docs.
[0.15.0] - 2024-07-23
In the wake of making this library less verbose and more consistent be aware about a few slight breaking changes around mostly inserts, updates and deletes.
- Renamed
casterargument toencoderwithin moduleinsert. - Renamed a lot of public function args to be consistent across the library.
- Added
INSERTdemo. - Added
DELETEdemo. - Changed insert param generation to automatically wrap.
- Changed update param functions to automatically wrap. Renamed them slightly.
[0.14.0] - 2024-07-19
- Added more utility to the
wheremodule, such aswhere.none,where.trueandwhere.false. - Fixed unit tests around
INSERT...ON CONFLICT...UPDATEwithWHEREclause. - Renamed
update.set_many_to_expressiontoupdate.sets_to_expressionandupdate.set_many_to_sub_querytoupdate.sets_to_sub_query. - Renamed
union_manytounions,union_all_manytounions_all,except_manytoexcepts,except_all_manytoexcepts_all, andintersect_manytointersects,intersect_all_manytointersects_allin modulecombined. - Made
where.similar_toescape_charan argument.
[0.13.0] - 2024-07-12
- Added
where.in_querywhich allows to use a sub-query as the right hand side of anINclause. - Added
where.sub_querywhich allows to use a sub-query as aWhereValue.
[0.12.0] - 2024-07-12
-
Re-export types which can be used in public APIs, this should hopefully close the last gaps to never be required to use
cake/internal/*modules.In case you are tempted to do so, please get in touch to see what we can do about it.
[0.11.0] - 2024-07-11
- Renamed
Queryand the internal query module toReadQueryandread_query. - Fixed some issues around upserts (INSERT ON CONFLICT UPDATE).
- Moved internal/params module into public namespace.
[0.10.1] - 2024-07-10
- Rename dialects such as
postgrestopostgres_dialect. - Fix demos and tests to use public APIs instead of internal ones.
[0.10.0] - 2024-07-09
- Provide public API to access the generated SQL and prepared statement
parameters in the base
cakeand newdialectmodules.
[0.9.2] - 2024-07-07
- Added more more applications.
- Added tests and snapshots for upserts.
[0.9.1] - 2024-07-05
- Fix test suite.
[0.9.0] - 2024-07-05
- Improved documentation.
- Added demo app abstraction.
- Added first runnable demo for
SELECTand decode.
[0.8.0] - 2024-07-03
- Flattened the query interface/DSL modules into the base namespace of
cake/. - Moved some modules only used internally into
cake/internal/namespace. - Fixed and improved test suite for
DELETEstatements. - Improved general documentation.
[0.7.0] - 2024-07-01
- Improved builder flexibility for inserts and updates.
- Added documentation for the
insert,updateanddeleteinterface modules. - Improved tests for
UPDATE. - Renamed
select.groups_bytoselect.group_bys. - Fixed bugs when updating with sub-queries, where specifying a sub_query while setting update columns to vales would remove all other settings.
[0.6.0] - 2024-06-27
- Added 🐬MySQL independent of 🦭MariaDB as first class supported.
[0.5.0] - 2024-06-26
- Fixed github CI and docker compose testing against 🐘PostgreSQL and 🦭MariaDB.
- Locally you should be able to install docker and then just run:
bin/docker/detached/and thengleam test. - Relaxed licence from AGPL 3.0 to Mozilla Public License 2.0 (MPL-2.0).
[0.4.0] - 2024-06-22
- Added support for deletes and interface modules
for
insert,update,deleteontop of the existingselectandcombinedinterface modules. - Added support for 🦭MariaDB and 🐬MySQL.
- Removed the hard dependency on any RDBMS specific
library. These are now only required when developing and testing
this library, but when running you can chose any of the following adapters:
pogsqlightgmysql
[0.3.0] - 2024-06-19
- Fixes around inserts, updates, moved a lot of deps to dev deps.
[0.2.0] - 2024-06-19
- A lot of polishing, support for inserts and updates.
[0.1.0] - 2024-05-22
- First preview / demo.