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(&pgsegment.JSONProvider{})
}
Print failed queries using DebugHook¶
import "github.com/go-pg/pg/extra/pgdebug"
db := pg.Connect(&pg.Options{...})
if debug {
db.AddQueryHook(pgdebug.DebugHook{
//Verbose: true,
})
}