Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 589 Bytes

README.md

File metadata and controls

35 lines (26 loc) · 589 Bytes

go-pg extensions

Faster JSON encoding by segmentio

import (
    "github.com/AirGateway/pg/pgjson"
    "github.com/AirGateway/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,
    })
}