sqlc-gen-cs: a very early beta C# plugin for SQLC
sqlc-gen-cs is a beta plugin for adding C# support via ADO .Net to SQLC
this plugin currently only supports Postgresql and cannot handle Enums! We're looking to expand this support very soon!
- Clone the repo
- In the repo folder run
make build - In your C# solution create your SQL files according to SQLC's getting started
- Change you sqlc.yaml to the following, editing the configuration accordingly
version: "2"sql:
- engine: "postgresql"queries: "queries.sql"schema: "schema.sql"codegen:
- out: modelsplugin: sqlc-gen-csoptions:
namespace: hyperbeam.modelsquery_param_limit: 1emit_async: trueplugins:
- name: sqlc-gen-csprocess:
cmd: ./path/to/sqlc-gen-cs- Run sqlc generate
- Enjoy your new CS files (Maybe run
dotnet formaton them too)
Currently supported plugin configuration options are:
- Most language agnostic config options from Sqlc as seen here barring engine. If you find any unsupported options open up an issue!
namespace- The namespace for the generated filesquery_param_limit- The amount of parameters to inline in the function declaration before creating a new class. -1 is no limit, 0 is invalid.emit_async- whether or not to emitawaitcompatible functions. Defaults to sync functions.