{"repo":"jschaf/pggen","free":true,"listed":false,"github":"https://github.com/jschaf/pggen","clone":"git clone https://github.com/jschaf/pggen.git","description":"Generate type-safe Go for any Postgres query. If Postgres can run the query, pggen can generate code for it.","language":"Go","stars":319,"topics":["postgres","query-compiler","orm","sql-queries"],"license":"MIT","category":"databases-storage","readme_excerpt":"pggen - generate type safe Go methods from Postgres SQL queries pggen generates Go code to provide a typesafe wrapper to run Postgres queries. If Postgres can run the query, pggen can generate code for it. The generated code is strongly-typed with rich mappings between Postgres types and Go types without relying on interface{} . pggen uses prepared queries, so you don't have to worry about SQL injection attacks. How to use pggen in three steps: 1. Write arbitrarily complex SQL queries with a name and a :one , :many , or :exec annotation. Declare inputs with pggen.arg('input name') . 2. Run pggen to generate Go code to create type-safe methods for each query. That command generates methods and type definitions like below. The full example is in [./example/composite/query.sql.go]. 3. Use the generated code. [./example/composite/query.sql.go]: ./example/composite/query.sql.go Pitch Why should you use pggen instead of the [myriad] of Go SQL bindings? - pggen generates code by introspecting the database system catalogs, so you can use any database extensions or custom methods, and it will just work. For database types that pggen doesn't recognize, you can provide your own type mappings. - pggen scales to Postgres databases of any size and supports incremental adoption. pggen is narrowly tailored to only generate code for queries you write in SQL. pggen will not create a model for every database object. Instead, pggen only generates structs necessary to run the queries you specify.","default_branch":null,"files":null,"tree":[],"storefront":"/r/jschaf","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/jschaf/pggen/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}