Skip to content

Taure/kura_sqlite

Repository files navigation

kura_sqlite

SQLite backend for kura. Provides kura_pool_sqlite, kura_driver_sqlite, kura_dialect_sqlite, and kura_backend_sqlite on top of the esqlite NIF driver.

Use

{deps, [
    {kura, "~> 2.4"},
    {kura_sqlite, "~> 0.2"}
]}.

Point kura at the backend in sys.config:

[{kura, [
    {repo, my_repo},
    {backend, kura_backend_sqlite},
    {database, <<"priv/my_app.db">>},   %% or <<":memory:">>
    {pool_size, 4}
]}].

kura_app:start/2 resolves the aggregator and auto-populates dialect, pool_module, and driver_module. Per-key overrides still win.

Status

Working: schemas, queries, migrations, INSERT … ON CONFLICT, RETURNING, transactions, JSON storage as TEXT, boolean as 0/1 (transparently round-tripped via kura_types:cast/2).

Not yet: kura_sandbox test fixtures, JSONB operators (->, ->>, @>), arrays.

kura_pool_sqlite:capabilities/0:

[returning, json, partial_indexes, transactions, savepoints, prepared_statements]

PG-only features (advisory_locks, listen_notify, arrays, jsonb) are deliberately absent; consumers that require them refuse to start on this backend via kura_capabilities:require/2.

Caveats

  • Booleans encode as INTEGER 0/1 on disk. kura_types:cast/2 transparently decodes them back to true/false on read, so user code is unaffected.
  • JSON values store as TEXT. JSONB operators (->, ->>, @>) are not available; use Erlang map operations after decoding.
  • Arrays are unsupported.
  • In-memory (<<":memory:">>) is per-connection. Use pool_size: 1 if multiple checkouts must observe the same data, or use a file path.

License

MIT.

About

SQLite backend for kura

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages