cake/adapter/postgres
🎂Cake 🐘PostgreSQL adapter which passes PreparedStatement
s
to the gleam_pgo
library for execution.
Functions
pub fn execute_raw_sql(
sql_string sql_string: String,
db_connection db_connection: Connection,
) -> Result(Returned(Dynamic), QueryError)
pub fn read_query_to_prepared_statement(
query query: ReadQuery,
) -> PreparedStatement
Convert a Cake ReadQuery
to a PreparedStatement
.
pub fn run_query(
query query: CakeQuery(a),
decoder decoder: fn(Dynamic) -> Result(a, List(DecodeError)),
db_connection db_connection: Connection,
) -> Result(List(a), QueryError)
Run a Cake CakeQuery
against an PostgreSQL database.
This function is a wrapper around run_read_query
and run_write_query
.
pub fn run_read_query(
query query: ReadQuery,
decoder decoder: fn(Dynamic) -> Result(a, List(DecodeError)),
db_connection db_connection: Connection,
) -> Result(List(a), QueryError)
pub fn run_write_query(
query query: WriteQuery(a),
decoder decoder: fn(Dynamic) -> Result(a, List(DecodeError)),
db_connection db_connection: Connection,
) -> Result(List(a), QueryError)
Run a Cake WriteQuery
against an PostgreSQL database.
pub fn with_connection(
host host: String,
port port: Int,
username username: String,
password password: Option(String),
database database: String,
callback callback: fn(Connection) -> a,
) -> a
Connection to a PostgreSQL database.
This is a thin wrapper around the gleam_pgo
library’s Connection
type.
pub fn write_query_to_prepared_statement(
query query: WriteQuery(a),
) -> PreparedStatement
Convert a Cake WriteQuery
to a PreparedStatement
.