github.com/shestakovda/wpgx (go): Package wpgx helps to improve loading performance and to simplify code.  Package wpgx uses concept of Shaper and Translator interfaces, that helps to map database names with struct fields.  Imagine, we have a simple User struct with an access Role field:  It is business-level objects, let's create a database model:  Note that model can have unexported name, it's because we use interfaces in wpgx.  To convert business to database we can implement Extrude method in Shaper interface:  Okay, to convert from database to business we can implement Receive method in Shaper interface:  Now, we can use something like this query to fetch user:  Let's implement Translator interface to map names:  To create database connection, just call Connect:  For performance issues we can to prepare statements but it is not required for select:  Now we can load user with ID=42:  Okay, but what if we need a list of users? No problems, let's implement Collector interface:  Now we can select list like this. For example all users with role:  Collector can use maps, channels or another type you want.  But what if we need to insert new user and fetch this id? For this task we have to prepare insert query with columns:  Save uses Collector as result type because you may want to return many rows.  All examples above can be used in one transaction, that called Dealer. Typically Dealer can be used like this:  Good luck!
Keywords: golang|pgx|postgresql