glimr_sqlite/db/query

Query execution for SQLite databases.

Provides functions for executing SELECT queries and statements that don’t return rows like INSERT, UPDATE, DELETE, and DDL statements.

Values

pub fn exec(
  conn: sqlight.Connection,
  sql: String,
) -> Result(Nil, pool_connection.DbError)

Executes a SQL statement that does not return rows, such as INSERT, UPDATE, DELETE, or DDL statements. Returns Ok on success or a database error on failure.

pub fn query(
  conn: sqlight.Connection,
  sql: String,
  params: List(sqlight.Value),
  decoder: decode.Decoder(t),
) -> Result(List(t), pool_connection.DbError)

Executes a SELECT query and decodes the results using the provided decoder. Returns a list of decoded rows on success or a database error on failure.

Search Document