{"repo":"emicklei/pgtalk","free":true,"listed":false,"github":"https://github.com/emicklei/pgtalk","clone":"git clone https://github.com/emicklei/pgtalk.git","description":"Go code generator to access PostgreSQL tables and views on top of pgx","language":"Go","stars":25,"topics":["orm","golang","pgx","generics"],"license":"MIT","category":"databases-storage","readme_excerpt":"pgtalk More type safe SQL query building and execution using Go code generated (pgtalk-gen) from PostgreSQL table definitions. After code generation, you get a Go type for each table or view with functions to create a QuerySet or MutationSet value. Except for query exectution, all operations on a QuerySet or MutationSet will return a copy of that value. This package requires Go SDK version 1.18+ because it uses type parameterization. status This package is used in production, e.g. https://ag5.com, and its programming API is stable since v1.0.0. install go install github.com/emicklei/pgtalk/cmd/pgtalk-gen@latest how to run the generator The user in the connection string must have the right privileges to read schema information. PGTALK CONN=postgresql://usr:pwd@localhost:5432/database pgtalk-gen -s public -o yourpackage go fmt ./... If you want to include and/or exclude table names, use additional flags such as: -include \"address. ,employee. \" -exclude \"org. \" or views -views -o yourpackage -include \"skills. \" examples These examples are from the test package in which a few database tables files (categories,products,things) are generated. Insert mut := products.Insert( products.ID.Set(10), products.Code.Set(\"testit\"), products.CategoryID.Set(1)) it := mut.Exec(conn) if it.Err() != nil { ... } or by example: p := new(products.Product) p.SetID(10).SetCode(\"testit\").SetCategoryID(1) mut := products.Insert(p.Setters()...) it := mut.Exec(conn) if it.Err() != nil { ... } Update mut :","default_branch":null,"files":null,"tree":[],"storefront":"/r/emicklei","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/emicklei/pgtalk/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."}