❤️ Uptrace.dev - distributed traces, logs, and errors in one place
- Docs
- Reference
- Examples
- RealWorld example app
- Use Discord or stackoverflow to ask questions.
- pgext - faster JSON encoding, OpenTelemetry hook, etc.
- Migrations by vmihailenco and robinjoseph08.
- Sharding.
- Model generator from SQL tables.
- urlstruct to decode
url.Values
into structs.
- 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
NULL
.pg:",notnull"
is used to add SQLNOT NULL
constraint andpg:",use_zero"
to allow Go zero values. - Transactions.
- Prepared statements.
- Notifications using
LISTEN
andNOTIFY
. - Copying data using
COPY FROM
andCOPY TO
. - 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.
- CountEstimate
using
EXPLAIN
to 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.