3 Data and persistence
Use open-sqlite, open-postgres, with-db and with-transaction for explicit connection and transaction ownership.
| (require loom/model) | package: loom |
define-model declares fields and basic types. validate-model rejects invalid or unknown fields; model-schema produces JSON Schema.
| (require loom/repository) | package: loom |
Repositories map explicit models to existing tables. CRUD, bounded filtered queries, counts and parent/child associations are supported. Use explicit primary keys, parameterized queries and application-owned authorization.
| (require loom/migrate) | package: loom |
Numbered migrations run transactionally with database locking on SQLite and PostgreSQL. Existing versions and descriptions are checked, but migration contents are not checksummed. There is no automatic down migration.
| (require loom/db-pool) | package: loom |
Connection pooling is bounded. Applications must manage connection session state; pooled connections do not automatically reset all settings.