kura_db (kura v2.0.6)

View Source

Central database wrapper. Routes all SQL through a configured kura_driver impl over a configured kura_pool impl, so swapping the underlying client (pgo, esqlite, ...) is one config change.

All driver calls go through this module, providing a single place for pool lookup, sandbox support, telemetry, and type loading.

Summary

Functions

build_log_event(Repo, SQL, Params, Result, DurationUs)

build_telemetry_metadata(RepoMod, SQL, Params, Result)

default_logger()

extract_source(SQL)

get_driver_module(RepoMod)

-spec get_driver_module(module()) -> module().

Resolve the kura_driver implementation module for a repo.

get_pool(RepoMod)

-spec get_pool(module()) -> atom().

get_pool_module(RepoMod)

-spec get_pool_module(module()) -> module().

Resolve the kura_pool implementation module for a repo.

load_row(SchemaMod, Row)

-spec load_row(module(), map()) -> map().

query(RepoMod, SQL, Params)

-spec query(module(), iodata(), [term()]) -> map() | {error, term()}.

transaction(RepoMod, Fun)

-spec transaction(module(), fun(() -> term())) -> term().

transaction_ok(RepoMod, Fun)

-spec transaction_ok(module(), fun(() -> term())) -> {ok, term()} | {error, term()}.