db

package
v0.0.0-...-3a75ae7 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

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

func FromContext(ctx context.Context) (*pgxpool.Pool, error)

FromContext returns the pool associated with the given context.

func FromRequest

func FromRequest(req *http.Request) (*pgxpool.Pool, error)

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

func WithContext(ctx context.Context, pool *pgxpool.Pool) context.Context

WithContext returns a new context with the given pool.

func WithTracer

func WithTracer(t pgx.QueryTracer) func(c *pgxpool.Config)

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.

Jump to

Keyboard shortcuts

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