-module(kura_backend_ets). -moduledoc """ ETS backend aggregator. One config knob for users: ```erlang {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](https://hex.pm/packages/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. """. -export([ pool_module/0, driver_module/0, dialect/0, capabilities/0 ]). -spec pool_module() -> module(). pool_module() -> kura_ets_pool. -spec driver_module() -> module(). driver_module() -> kura_ets_driver. -spec dialect() -> module(). dialect() -> kura_ets_dialect. -doc "Forwards to `kura_ets_pool:capabilities/0` so consumers can query the backend's feature set without knowing the impl module names.". -spec capabilities() -> kura_capabilities:capability_set(). capabilities() -> kura_ets_pool:capabilities().