stephen / sqlc-ts

a sqlc plugin for generating sql.js-compatible queries

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sqlc-ts

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.

Installation & Usage

$ 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

About

a sqlc plugin for generating sql.js-compatible queries


Languages

Language:Go 98.5%Language:Makefile 1.5%