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"
)

func init() {
    pgjson.SetProvider(pgext.SegmentJSONProvider{})
}
import "github.com/go-pg/pg/extra/pgdebug"

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

if debug {
    db.AddQueryHook(pgdebug.DebugHook{
        //Verbose: true,
    })
}