cake/adapter/mysql

🎂Cake 🐬MySQL adapter which passes PreparedStatements to the gmysql library for execution.

Functions

pub fn execute_raw_sql(
  query_string query_string: String,
  db_connection db_connection: Connection,
) -> Result(Nil, Error)

Execute a raw SQL query against an 🐬MySQL database.

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), Error)

Run a Cake CakeQuery against an 🐬MySQL 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), Error)
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), Error)

Run a Cake WriteQuery against an 🐬MySQL database.

pub fn with_connection(
  host host: String,
  port port: Int,
  username username: Option(String),
  password password: Option(String),
  database database: String,
  callback callback: fn(Connection) -> a,
) -> a

Connection to a 🐬MySQL database.

This is a thin wrapper around the gmysql library’s Connection type.

pub fn write_query_to_prepared_statement(
  query query: WriteQuery(a),
) -> PreparedStatement

Convert a Cake WriteQuery to a PreparedStatement.

Search Document