pg

package module
v0.0.0-...-7ebff8f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2024 License: Apache-2.0, BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Example
conn := pg.Connect(&pg.Options{
	User:     "go-pg-test",
	Database: "datadog",
})

// Wrap the connection with the APM hook.
pg2.Wrap(conn)
var user struct {
	Name string
}
_, err := conn.QueryOne(&user, "SELECT name FROM users")
if err != nil {
	log.Fatal(err)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wrap

func Wrap(db *pg.DB, opts ...Option)

Wrap augments the given DB with tracing.

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option describes options for the go-pg integration.

type OptionFn

type OptionFn func(*config)

OptionFn represents options applicable to Wrap.

func WithAnalytics

func WithAnalytics(on bool) OptionFn

WithAnalytics enables Trace Analytics for all started spans.

func WithAnalyticsRate

func WithAnalyticsRate(rate float64) OptionFn

WithAnalyticsRate sets the sampling rate for Trace Analytics events correlated to started spans.

func WithService

func WithService(name string) OptionFn

WithService sets the given service name for the client.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL