rally_runtime/db

Values

pub fn bool_to_int(val: Bool) -> sqlight.Value
pub fn collapse_whitespace(sql: String) -> String
pub fn get_timing() -> #(Int, Int)

Get accumulated DB timing for the current request. Returns #(total_milliseconds, query_count).

pub fn init_timing() -> Nil

Reset accumulated DB timing. Call at the start of each request/message.

pub fn nullable_text(val: option.Option(String)) -> sqlight.Value
pub fn one(rows: List(a)) -> option.Option(a)
pub fn open(
  path: String,
) -> Result(sqlight.Connection, sqlight.Error)
pub fn query(
  sql sql: String,
  on conn: sqlight.Connection,
  with params: List(sqlight.Value),
  expecting decoder: decode.Decoder(a),
) -> Result(List(a), sqlight.Error)

Timed query wrapper. Same signature as sqlight.query but adds debug logging with query text, param count, elapsed time, and row count. Accumulates timing in the process dictionary for per-request totals.

pub fn transaction(
  conn: sqlight.Connection,
  body: fn() -> Result(a, sqlight.Error),
) -> Result(a, sqlight.Error)
Search Document