mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-19 01:24:20 +01:00
bindings/wasm: Add example using Drizzle ORM
This commit is contained in:
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": "",
|
"author": "",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"better-sqlite3": "^11.5.0",
|
||||||
|
"drizzle-orm": "^0.36.3",
|
||||||
"limbo-wasm": "../pkg"
|
"limbo-wasm": "../pkg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user