Typed async MySQL pool for native MoonBit using Connector/C workers
Dependencies
options(link: { "native": { "cc-link-flags": "-lmariadb -lpthread" } })let pool = @mysql.Pool::new(
host="127.0.0.1", user="app", password="password", database="app", size=4,
)
let db = pool.database()
defer db.close()
let rows = db.query("SELECT name FROM users WHERE id=?", params=[Integer(42L)])
for row in rows {
if row.get("name") is Some(Text(name)) { println(name) }
}pub(all) suberror DatabaseError {
InvalidConfig(String)
InvalidParameter
ServerError(Int)
CompletionLost
WorkerUnavailable
ResultTooLarge
} derive(Debug)pub struct Pool {
// private fields
}async fn Pool::new(host~ : String, user~ : String, password~ : String, database~ : String, port? : Int, size? : Int, ssl_ca? : String, plugin_dir? : String, timeout_seconds? : Int, max_rows? : Int, max_bytes? : Int, max_waiters? : Int, checkout_timeout_ms? : Int, charset? : String, time_zone? : String, found_rows? : Bool) -> PoolInstall
Download zipTyped async MySQL pool for native MoonBit using Connector/C workers
Dependencies