{"repo":"kanmu/dgw","free":true,"listed":false,"github":"https://github.com/kanmu/dgw","clone":"git clone https://github.com/kanmu/dgw.git","description":"dgw generates Golang struct, and simple Table/Row Data Gateway functions from PostgreSQL table metadata","language":"Go","stars":190,"topics":["go","sql","generator","postgresql","db"],"license":"MIT","category":"databases-storage","readme_excerpt":"dgw Description dgw generates Golang struct, and simple Table/Row Data Gateway functions from PostgreSQL table metadata. Heavily inspired by xo. Why created Personally, I prefer Table/Row Data Gateway over ORM/Query Builder approach when using Go with RDBMS. However, it is very time consuming, tedious, and error-prone to write a lot of columns, query place holders, and struct fields that all have to be exactly in order even for a simple select/insert statement. dgw generate Go struct, and simple functions to get/create row from PostgreSQL table definitions to avoid manually writing simple but tedious SQL. - dgw can properly detect autogenerated column (e.g. serial, bigserial), and composit primary key to create appropriate SQL. - dgw has ability to easily customize PostgreSQL column type Go type mapping using toml config file. Installation How to use Excluding columns --exclude-column ( -X ) drops a column from the generated struct field, and from the generated INSERT / SELECT statements. It must be given in table.column format, so a bare column name is rejected. Pass the flag multiple times to exclude more than one column. dgw stops with an error, instead of generating broken code, when the exclusion is: - a primary key column ( GetXByPk would no longer match the table) - a table or column which does not exist in the schema (usually a typo) - every column of a table (use --exclude to skip the whole table) Example - https://github.com/kanmu/dgw/tree/master/example Generate Go","default_branch":null,"files":null,"tree":[],"storefront":"/r/kanmu","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/kanmu/dgw/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."}