# Cake SQL Query Builder for Gleam
Cake is a library written in Gleam to compose SQL queries targeting SQL dialects PostgreSQL, SQLite, MariaDB and MySQL.
[
Version](https://img.shields.io/hexpm/v/cake)](https://hex.pm/packages/cake)
[](https://hexdocs.pm/cake/)



## Installation
```shell
gleam add cake
```
Further documentation can be found at <https://hexdocs.pm/cake>.
## Examples
See Cake's [tests](https://github.com/inoas/gleam-cake/tree/main/test/cake_test).
## Tested targets
- Sqlite3 of [ubuntu:latest (Docker)](https://hub.docker.com/_/ubuntu)
- [postgres:latest (Docker)](https://hub.docker.com/_/postgres)
- [mariadb:latest (Docker)](https://hub.docker.com/_/mariadb)
- [mysql:latest (Docker)](https://hub.docker.com/_/mysql)
The tests run on Erlang but are generally target agnostic:
While the primary use case is to run queries on servers, this library runs on any Gleam target and for example in conjunction with [sqlite3 WASM/JS](https://sqlite.org/wasm) you may run queries composed with this library in browsers.
## Development
### Run test suite locally
```shell
bin/docker/attached
# wait a few seconds until everything is ready
# if you run gleam test too early, it will crash
gleam test
# or instead of gleam test, run:
# gleam test -- --glacier
# ...for incremental testing
```
### Helper commands
```shell
bin/docker/attached
bin/docker/detached
bin/docker/down
bin/test
bin/glacier
bin/birdie/interactive-review
bin/birdie/accept-all
bin/birdie/reject-all
```
## Library naming
The best part of working with CakePHP 3+ used to be its Query Builder. This library is inspired by that and thus the name.
Thank you [@lorenzo](https://github.com/lorenzo) and [@markstory](https://github.com/markstory) for creating and maintaining CakePHP and its awesome query builder over the years.