# README
go-pg extensions
Faster JSON encoding by segmentio
import (
"github.com/go-pg/pg/v10/pgjson"
"github.com/go-pg/pgext"
)
func init() {
pgjson.SetProvider(pgext.SegmentJSONProvider{})
}
Tracing using OpenTelemetryHook
For more details see documentation:
db := pg.Connect(&pg.Options{...})
db.AddQueryHook(&pgext.OpenTelemetryHook{})
Print failed queries using DebugHook
db := pg.Connect(&pg.Options{...})
if debug {
db.AddQueryHook(&pgext.DebugHook{
//Verbose: true,
})
}
# Structs
DebugHook is a query hook that logs an error with a query if there are any.
OpenTelemetryHook is a pg.QueryHook that adds OpenTelemetry instrumentation.
No description provided by the author