A CLI tool to generate SQLC-compatible CRUD operations from PostgreSQL schemas.
Standing on the shoulders of giants - most of the code was written with the assistance of Claude 3.5 Sonnet. This tool is made possible by these excellent projects:
- sqlc - The SQL compiler that makes this useful
- pg_query_go - PostgreSQL parser from pganalyze
- Go 1.23 - The Go programming language
- Claude 3.5 Sonnet - Primary coding assistant
- VSCode - Code editor
- continue.dev - AI coding assistant
Special thanks to all the teams and contributors behind these tools.
go install github.com/kaashmonee/go-pg-sqlc-crud@latest
go-pg-sqlc-crud generate -schema ./schema.sql -output ./generated/schema.crud.sql
-schema
: Path to the PostgreSQL schema dump file (required)-output
: Path where the generated CRUD file should be written (required)
# Generate CRUD operations from a schema file
go-pg-sqlc-crud generate -schema ./schema.sql -output ./generated/crud.sql
- Takes a PostgreSQL schema dump as input
- Uses pg_query_go to parse the schema into an AST
- Generates SQLC-compatible CRUD queries
- Writes the queries to the specified output file
MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.