kura_backend_ets (kura_ets v0.0.1)

View Source

ETS backend aggregator. One config knob for users:

{repos, #{
    my_repo => #{
        backend => kura_backend_ets
    }
}}.

The aggregator wires up:

  • pool_module -> kura_ets_pool
  • driver_module -> kura_ets_driver
  • dialect -> kura_ets_dialect
  • capabilities -> declared on kura_ets_pool

Unlike the SQL backends, this backend does not compile queries to SQL. The dialect emits an opaque {kura_ets, Plan} term (the portable #kura_query{} AST plus operation data) and the driver interprets it against per-table ETS tables, in the same spirit as etso does for Ecto.

Intended for tests, caches, and small in-memory datasets. Data lives in ETS and is lost when the pool stops.

Feature coverage

Supported: insert / insert_all (with on_conflict targeting the primary key), get / get_by / one / all with wheres (=, !=, <, >, <=, >=, in, not_in, between, like, ilike, is_nil, is_not_nil, and / or / not, composite-column in), order_by, limit / offset, distinct, aggregates (count / sum / avg / min / max), update / delete by primary key, update_all / delete_all, soft delete, and attribute-based multitenancy.

Not supported (queries return {error, {kura_ets_unsupported, _}}): joins, group_by / having, CTEs, combinations (union etc.), subqueries, fragments, full-text matches, row locks, prefix-based multitenancy, raw SQL (including migrations, many_to_many association persistence and optimistic locking, which build SQL strings directly).

transaction/4 runs the fun without atomicity: there is no rollback, so a failed multi-step operation leaves earlier writes in place.

Summary

Functions

Forwards to kura_ets_pool:capabilities/0 so consumers can query the backend's feature set without knowing the impl module names.

Functions

capabilities()

-spec capabilities() -> kura_capabilities:capability_set().

Forwards to kura_ets_pool:capabilities/0 so consumers can query the backend's feature set without knowing the impl module names.

dialect()

-spec dialect() -> module().

driver_module()

-spec driver_module() -> module().

pool_module()

-spec pool_module() -> module().