Programming language: Go
Latest version: v10.0.0-beta.2
go-pg alternatives and similar packages
Based on the "ORM" category
Scout gets developers back to coding faster. An intuitive UI streamlines real-time performance insight so you can quickly pinpoint & resolve issues before the customer ever sees them. Start your free trial today!
Do you think we are missing an alternative of go-pg or a related project?
PostgreSQL client and ORM for Golang
- Join Discord to ask questions.
- Example projects:
- GraphQL Tutorial on YouTube.
- pgext - faster JSON encoding, OpenTelemetry hook, etc.
- Migrations by vmihailenco and robinjoseph08.
- Genna - cli tool for generating go-pg models.
- urlstruct to decode
- Basic types: integers, floats, string, bool, time.Time, net.IP, net.IPNet.
- sql.NullBool, sql.NullString, sql.NullInt64, sql.NullFloat64 and pg.NullTime.
- sql.Scanner and sql/driver.Valuer interfaces.
- Structs, maps and arrays are marshalled as JSON by default.
- PostgreSQL multidimensional Arrays using array tag and Array wrapper.
- Hstore using hstore tag and Hstore wrapper.
- Composite types.
- All struct fields are nullable by default and zero values (empty string, 0, zero time, empty map
or slice, nil ptr) are marshalled as SQL
pg:",notnull"is used to add SQL
NOT NULLconstraint and
pg:",use_zero"to allow Go zero values.
- Prepared statements.
- Notifications using
- Copying data using
- Timeouts and canceling queries using context.Context.
- Automatic connection pooling with circuit breaker support.
- Queries retry on network errors.
- Working with models using ORM and SQL.
- Scanning variables using ORM and SQL.
- SelectOrInsert using on-conflict.
- INSERT ... ON CONFLICT DO UPDATE using ORM.
- Bulk/batch inserts, updates, and deletes.
- Common table expressions using WITH and WrapWith.
EXPLAINto get estimated number of matching rows.
- ORM supports has one, belongs to, has many, and many to many with composite/multi-column primary keys.
- Soft deletes.
- Creating tables from structs.
- ForEach that calls a function for each row returned by the query without loading all rows into the memory.
- Works with PgBouncer in transaction pooling mode.