mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-03 09:42:22 +00:00
bindings/wasm: Add example using Drizzle ORM
This commit is contained in:
parent
81b68b7047
commit
a18f33f93b
2 changed files with 14 additions and 0 deletions
12
bindings/wasm/examples/drizzle.js
Normal file
12
bindings/wasm/examples/drizzle.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { drizzle } from 'drizzle-orm/better-sqlite3';
|
||||
import * as s from 'drizzle-orm/sqlite-core';
|
||||
import { Database } from 'limbo-wasm';
|
||||
|
||||
const sqlite = new Database('sqlite.db');
|
||||
const db = drizzle({ client: sqlite });
|
||||
const users = s.sqliteTable("users", {
|
||||
id: s.integer(),
|
||||
name: s.text(),
|
||||
})
|
||||
const result = db.select().from(users).all();
|
||||
console.log(result);
|
|
@ -11,6 +11,8 @@
|
|||
"author": "",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"better-sqlite3": "^11.5.0",
|
||||
"drizzle-orm": "^0.36.3",
|
||||
"limbo-wasm": "../pkg"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue