Skip to content

Commit

Permalink
Add turso and @libsql/client implementation for sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
samvimes01 committed Aug 27, 2024
1 parent 54496e9 commit a4fe473
Show file tree
Hide file tree
Showing 11 changed files with 1,197 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: generate

generate: examples/plugin.wasm examples/sqlc.dev.yaml
cd examples && sqlc-dev -f sqlc.dev.yaml generate
cd examples && sqlc -f sqlc.dev.yaml generate

# https://github.com/bytecodealliance/javy/releases/tag/v1.2.0
examples/plugin.wasm: out.js
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ sql:
- PostgreSQL via [pg](https://www.npmjs.com/package/pg) or [postgres](https://www.npmjs.com/package/postgres).
- MySQL via [mysql2](https://www.npmjs.com/package/mysql2).
- SQLite via [sqlite3](https://www.npmjs.com/package/better-sqlite3).
- SQLite fork Turso via [@libsql/client](https://www.npmjs.com/package/@libsql/client).
## Getting started
Expand Down Expand Up @@ -332,4 +333,24 @@ sql:
options:
runtime: node
driver: better-sqlite3 # npm package name
### Turso SQLite and @libsql/client (Beta)
```yaml
version: '2'
plugins:
- name: ts
wasm:
url: https://downloads.sqlc.dev/plugin/sqlc-gen-typescript_0.1.4.wasm
sha256: 96fd05db0dc835ffd005b9f571fa5fa6d6cbd5a74e653ca34c2920c1b5d06249
sql:
- schema: "schema.sql"
queries: "query.sql"
engine: sqlite
codegen:
- out: db
plugin: ts
options:
runtime: node
driver: turso
```
332 changes: 332 additions & 0 deletions examples/node-turso/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions examples/node-turso/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "turso",
"version": "1.0.0",
"description": "",
"main": "src/main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"typescript": "^5.2.2"
},
"dependencies": {
"@libsql/client": "0.6.2"
}
}
Loading

0 comments on commit a4fe473

Please sign in to comment.