Documentation ¶
Index ¶
- Variables
- func FromContext(ctx context.Context) (*pgxpool.Pool, error)
- func FromRequest(req *http.Request) (*pgxpool.Pool, error)
- func Middleware(db *pgxpool.Pool) middleware.MiddlewareFunc
- func WithContext(ctx context.Context, pool *pgxpool.Pool) context.Context
- func WithTracer(t pgx.QueryTracer) func(c *pgxpool.Config)
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrDBPoolNotFound = errors.New("sql/db: unable to retrieve db pool from request context.")
)
Functions ¶
func FromContext ¶
FromContext returns the pool associated with the given context.
func FromRequest ¶
FromRequest returns the pool associated with the given http request.
func Middleware ¶
func Middleware(db *pgxpool.Pool) middleware.MiddlewareFunc
Middleware returns a middleware that injects the given pool into the request context.
func WithContext ¶
WithContext returns a new context with the given pool.
func WithTracer ¶
WithTracer sets the query tracer for the database pool.
Checkout [pgxotel.Tracer] for an opentelemetry tracing implementation.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
Package dbtesting providers utilities for testing database related code.
|
Package dbtesting providers utilities for testing database related code. |
This module is wrapped off completely from https://github.com/jackc/pgx-gofrs-uuid and adapted to use github.com/google/uuid instead of github.com/gofrs/uuid.
|
This module is wrapped off completely from https://github.com/jackc/pgx-gofrs-uuid and adapted to use github.com/google/uuid instead of github.com/gofrs/uuid. |
Click to show internal directories.
Click to hide internal directories.