Skip to content

kaashmonee/go-pg-sqlc-crud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy