runebook · rune
runebook · rune
No capabilities requested.
manifest: sha256:837c5f6e93da4e1640737eefe8f3454a645a1e28af55de5c847e9f7244d12864
rune add @rune/mysql@0.1.0rune add @rune/mysql
Provide a MySQL URL whose database already exists. The pool creates its storage table and uses prepared statements. MariaDB uses the same adapter and connection syntax.
import { connect } from "@rune/mysql";
import { document } from "@rune/storage";
const db = await connect(process.env.DATABASE_URL!);
const visits = document(db.store, "visits", () => ({ total: 0 }));
await visits.update((value) => ({ total: value.total + 1 }));
// Call await db.close() when the connection is no longer needed.
Wrap an existing driver instance with mysqlStore(pool).
Use db.store with Web Auth, or as a general-purpose record store.