cake/adapter/sqlite

🎂Cake 🪶SQLite adapter which passes PreparedStatements to the sqlight library for execution.

Functions

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

Execute a raw SQL query against an SQLite 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 SQLite 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)

Run a Cake ReadQuery against an SQLite database.

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 SQLite database.

pub fn with_connection(
  filename filename: String,
  callback callback: fn(Connection) -> a,
) -> a

Connection to a SQLite database.

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

pub fn with_memory_connection(
  callback callback: fn(Connection) -> a,
) -> a

Connection to an in-memory SQLite database.

This is a thin wrapper around the sqlight 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