Categorygithub.com/kaashmonee/go-pg-sqlc-crud
modulepackage
0.0.0-20241227191426-4208f05c1cd7
Repository: https://github.com/kaashmonee/go-pg-sqlc-crud.git
Documentation: pkg.go.dev

# README

go-pg-sqlc-crud

A CLI tool to generate SQLC-compatible CRUD operations from PostgreSQL schemas.

Built With

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:

Core Dependencies

  • sqlc - The SQL compiler that makes this useful
  • pg_query_go - PostgreSQL parser from pganalyze
  • Go 1.23 - The Go programming language

Development Tools

Special thanks to all the teams and contributors behind these tools.

Installation

go install github.com/kaashmonee/go-pg-sqlc-crud@latest

Usage

go-pg-sqlc-crud generate -schema ./schema.sql -output ./generated/schema.crud.sql

Flags

  • -schema: Path to the PostgreSQL schema dump file (required)
  • -output: Path where the generated CRUD file should be written (required)

Example

# Generate CRUD operations from a schema file
go-pg-sqlc-crud generate -schema ./schema.sql -output ./generated/crud.sql

How It Works

  1. Takes a PostgreSQL schema dump as input
  2. Uses pg_query_go to parse the schema into an AST
  3. Generates SQLC-compatible CRUD queries
  4. Writes the queries to the specified output file

License

MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

# Packages

No description provided by the author
No description provided by the author