sqlc-ts is a sqlc plugin to generate queries that are compatible with @stephen/sql.js.
This plugin is early-stage and is not quite production ready.
$ go install github.com/kyleconroy/sqlc/cmd/sqlc@latest
$ go install github.com/stephen/sqlc-ts@latest
// sqlc.json
{
"version": "2",
"plugins": [
{
"name": "ts",
"process": {
"cmd": "sqlc-ts"
}
}
],
"sql": [
{
"schema": "schema.sql",
"queries": "query.sql",
"engine": "sqlite",
"codegen": [
{
"out": "gen",
"plugin": "ts"
}
]
}
]
}
See testdata/
for a full example that can be run with:
$ sqlc generate -f ./testdata/sqlc.json && cat ./testdata/gen/query.sql.ts | less