glimr_postgres/db/query
Query execution for PostgreSQL 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: pog.Connection,
sql: String,
) -> Result(Int, pool_connection.DbError)
Executes a SQL statement that does not return rows, such as INSERT, UPDATE, DELETE, or DDL statements. Returns the affected row count on success or a database error on failure.
pub fn query(
conn: pog.Connection,
sql: String,
params: List(pog.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.