Skip to content

Commit

Permalink
Update example_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
knusbaum authored Oct 22, 2020
1 parent 8c22a72 commit 9a5ff05
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions contrib/go-pg/pg.v10/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ func Example() {

// Wrap the connection with the APM hook
pgtrace.Wrap(conn)
// For correct tracing, must be query execute with context.
var user struct {
Name string
}
_, err := conn.WithContext(context.Background()).QueryOne(&user, "SELECT name FROM users")
_, err := conn.QueryOne(&user, "SELECT name FROM users")
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit 9a5ff05

Please sign in to comment.