Skip to content

Extra modules

OpenTelemetry

See tracing.

Faster JSON encoding by segmentio

import (
    "github.com/go-pg/pg/v10/pgjson"
    "github.com/go-pg/pg/extra/pgsegment/v10"
)

func init() {
    pgjson.SetProvider(pgsegment.NewJSONProvider())
}
import "github.com/go-pg/pg/extra/pgdebug/v10"

db := pg.Connect(&pg.Options{...})

if debug {
    db.AddQueryHook(pgdebug.NewDebugHook())
}