Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit31d4796

Browse files
authored
feat: Experimental support for Node.js andbetter-sqlite3 (#11)
1 parentdaaf539 commit31d4796

File tree

11 files changed

+1232
-1
lines changed

11 files changed

+1232
-1
lines changed

‎README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,3 +311,24 @@ sql:
311311
runtime: node
312312
driver: mysql2 # npm package name
313313
```
314+
315+
### SQLite and better-sqlite3 (Beta)
316+
317+
```yaml
318+
version: '2'
319+
plugins:
320+
- name: ts
321+
wasm:
322+
url: https://downloads.sqlc.dev/plugin/sqlc-gen-typescript_0.1.3.wasm
323+
sha256: 287df8f6cc06377d67ad5ba02c9e0f00c585509881434d15ea8bd9fc751a9368
324+
sql:
325+
- schema: "schema.sql"
326+
queries: "query.sql"
327+
engine: sqlite
328+
codegen:
329+
- out: db
330+
plugin: ts
331+
options:
332+
runtime: node
333+
driver: better-sqlite3 # npm package name
334+
```

‎examples/authors/sqlite/query.sql

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
-- name: GetAuthor :one
2+
SELECT*FROM authors
3+
WHERE id= ?LIMIT1;
4+
5+
-- name: ListAuthors :many
6+
SELECT*FROM authors
7+
ORDER BY name;
8+
9+
-- name: CreateAuthor :exec
10+
INSERT INTO authors (
11+
name, bio
12+
)VALUES (
13+
?, ?
14+
);
15+
16+
-- name: DeleteAuthor :exec
17+
DELETEFROM authors
18+
WHERE id= ?;

‎examples/authors/sqlite/schema.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CREATETABLEauthors (
2+
idINTEGERPRIMARY KEY AUTOINCREMENT,
3+
nametextNOT NULL,
4+
biotext
5+
);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp