A suggestion from this Twitter thread is to implement the project as a sqlc WASM plugin. This would allow users to get the grpc codegen output from this project directly from sqlc generate. An example sqlc.yaml config might look like:
version: '2'
plugins:
- name: walterwanderley-sqlc-grpc
wasm:
url: https://some.cdn/walterwanderley-sqlc-grpc.wasm
sha256: ""
sql:
- schema: schema.sql
queries: query.sql
engine: postgresql
codegen:
- plugin: walterwanderley-sqlc-grpc
out: sqlc
options:
module: "my-module"
tracing: true
litefs: true
gen:
go:
out: sqlc
sql_package: pgx/v5
Running sqlc generate with this config would put both the typical sqlc Go codegen output and the grpc output from this project in the sqlc directory.
There's a sqlc plugin sdk for Go which should make the implementation a little more straightforward.
The only hiccup I can think of would be that sqlc's GenerateRequest proto message that sqlc hands to a plugin may not have enough information to support the grpc codegen work as you've currently implemented it.
A suggestion from this Twitter thread is to implement the project as a sqlc WASM plugin. This would allow users to get the grpc codegen output from this project directly from
sqlc generate. An example sqlc.yaml config might look like:Running
sqlc generatewith this config would put both the typical sqlc Go codegen output and the grpc output from this project in thesqlcdirectory.There's a sqlc plugin sdk for Go which should make the implementation a little more straightforward.
The only hiccup I can think of would be that sqlc's
GenerateRequestproto message that sqlc hands to a plugin may not have enough information to support the grpc codegen work as you've currently implemented it.