Versions in this module Expand all Collapse all v0 v0.2.0 Apr 27, 2026 Changes in this version + type CachingPasswordResolver struct + func NewCachingPasswordResolver(inner PasswordResolver, ttl time.Duration) *CachingPasswordResolver + func (r *CachingPasswordResolver) Invalidate(tenantID string) + func (r *CachingPasswordResolver) Resolve(ctx context.Context, tenantID string) (string, error) type Config + DSNTemplate string + PasswordResolver PasswordResolver + type KVPasswordResolver struct + func NewKVPasswordResolver(vaultName, template string) (*KVPasswordResolver, error) + func NewKVPasswordResolverWithCredential(vaultName, template string, cred azcore.TokenCredential) (*KVPasswordResolver, error) + func (r *KVPasswordResolver) Resolve(ctx context.Context, tenantID string) (string, error) + type PasswordResolver interface + Resolve func(ctx context.Context, tenantID string) (string, error) + func StaticPasswordResolver(pw string) PasswordResolver + type PasswordResolverFunc func(ctx context.Context, tenantID string) (string, error) + func (f PasswordResolverFunc) Resolve(ctx context.Context, tenantID string) (string, error) v0.1.0 Apr 24, 2026 Changes in this version + var ErrInvalidConfig = errors.New("tenantpool: invalid config") + var ErrNoPool = errors.New("tenantpool: no pool in context") + var ErrPoolExhausted = errors.New("tenantpool: pool exhausted") + var ErrTenantNotFound = errors.New("tenantpool: tenant not found") + var ErrUpstreamUnreachable = errors.New("tenantpool: upstream unreachable") + func DefaultErrorHandler(w http.ResponseWriter, _ *http.Request, err error) + func DirectDSN(opts DirectOpts) func(string) (string, error) + func PgBouncerDSN(opts PgBouncerOpts) func(string) (string, error) + func PoolFromCtx(ctx context.Context) *pgxpool.Pool + func PoolFromCtxOK(ctx context.Context) (*pgxpool.Pool, bool) + func SupavisorDSN(opts SupavisorOpts) func(string) (string, error) + func WithPool(ctx context.Context, pool *pgxpool.Pool) context.Context + type Config struct + ConfigurePool func(*pgxpool.Config) error + DSNBuilder func(tenantID string) (string, error) + DatabaseURL string + IdleTimeout time.Duration + MaxConnsPerPool int32 + MaxPoolsCached int + MinConnsPerPool int32 + Resolver Resolver + type DirectOpts struct + ExtraParams map[string]string + Host string + Password string + SSLMode string + User string + type ErrorHandler func(w http.ResponseWriter, r *http.Request, err error) + type Metrics struct + Acquire prometheus.Histogram + PoolErrors *prometheus.CounterVec + PoolsActive prometheus.Gauge + PoolsCreated prometheus.Counter + PoolsEvicted prometheus.Counter + func NewMetrics(constLabels map[string]string) *Metrics + func (m *Metrics) Collectors() []prometheus.Collector + type MiddlewareOption func(*middlewareOptions) + func WithErrorHandler(h ErrorHandler) MiddlewareOption + func WithResolver(res Resolver) MiddlewareOption + type PgBouncerOpts = DirectOpts + type Registry struct + func New(cfg Config) (*Registry, error) + func (r *Registry) Close() + func (r *Registry) EvictIdle() int + func (r *Registry) Get(ctx context.Context, tenantID string) (*pgxpool.Pool, error) + func (r *Registry) Invalidate(tenantID string) + func (r *Registry) Middleware(opts ...MiddlewareOption) func(http.Handler) http.Handler + func (r *Registry) Stats() Stats + func (r *Registry) WithMetrics(m *Metrics) *Registry + type Resolver func(r *http.Request) (tenantID string, err error) + func HeaderResolver(name string) Resolver + func StaticResolver(tenantID string) Resolver + type Stats struct + ActivePools int + Created uint64 + Errors uint64 + Evicted uint64 + Hits uint64 + Misses uint64 + SingleMode bool + type SupavisorOpts struct + DBName string + ExtraParams map[string]string + Host string + Password string + SSLMode string + UserPrefix string