import { createMariadbPool } from '@pwngh/economy-lab/engines/mysql-mariadb';
import { mysqlStore } from '@pwngh/economy-lab/engines/mysql';
const pool = await createMariadbPool('mysql://econ:secret@127.0.0.1:3306/economy', {
connectionLimit: 32,
});
const store = mysqlStore({ pool, schema: 'assert' });
Create a MysqlPool from a connection URL using the
mariadbdriver — the pipelining-capable opt-in behind the same seamcreateMysqlPoolfills withmysql2. Same store, same schema, same SQL: hand the pool tomysqlStoreand every statement above the seam is identical. The difference is the wire: mysql2's command queue holds one command in flight per connection, while mariadb writes the next command before the previous response returns.Matches the mysql2 pool's configuration: big integer and decimal columns come back as exact strings (the engine converts them to bigint), and the connection collation is pinned to the schema's utf8mb4 default.
connectionLimitcaps the pool exactly as oncreateMysqlPooland defaults to 10; each in-flight transaction holds one connection, so size it to at least the number of concurrent submits. The URL must carry no query parameters — this factory maps the URL to driver config by hand and throws rather than silently drop options mysql2 would honor.