dbpool

package
v0.0.0-...-4812cd2 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

README

Package cloudeng.io/aws/dbpool

import cloudeng.io/aws/dbpool

Types

Type Option
type Option func(o *options)

Option is a functional option for configuring the connection pool.

Functions
func WithAWSConfig(cfg aws.Config) Option

WithAWSConfig sets the AWS configuration to be used by the TokenGenerator. The default is to look for the config in the context, but this option allows it to be explicitly provided.

func WithAcquireConnection(acquire bool) Option

WithAcquireConnection forces the pool to acquire a connection during initialization. This can be used to validate the connection parameters and fail fast if there are issues.

func WithServerName(serverName string) Option

WithServerName sets the TLS ServerName for connections in the pool. This is required for services like DSQL that use the ServerName for routing and authentication.

func WithTokenGenerator(tokenGenerator TokenGenerator) Option

WithTokenGenerator sets a custom TokenGenerator that will be called to generate a fresh authentication token for every new connection. This is essential for services like DSQL that require short-lived tokens.

Type Pool
type Pool struct {
	*pgxpool.Pool
}

Pool is a thin wrapper around pgxpool.Pool that simplifies creating connection pools.

Functions
func NewConnectionPool(ctx context.Context, connection string, opts ...Option) (*Pool, error)
Type TokenGenerator
type TokenGenerator func(ctx context.Context, cfg aws.Config) (string, error)

TokenGenerator is a function type that generates an authentication token.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(o *options)

Option is a functional option for configuring the connection pool.

func WithAWSConfig

func WithAWSConfig(cfg aws.Config) Option

WithAWSConfig sets the AWS configuration to be used by the TokenGenerator. The default is to look for the config in the context, but this option allows it to be explicitly provided.

func WithAcquireConnection

func WithAcquireConnection(acquire bool) Option

WithAcquireConnection forces the pool to acquire a connection during initialization. This can be used to validate the connection parameters and fail fast if there are issues.

func WithServerName

func WithServerName(serverName string) Option

WithServerName sets the TLS ServerName for connections in the pool. This is required for services like DSQL that use the ServerName for routing and authentication.

func WithTokenGenerator

func WithTokenGenerator(tokenGenerator TokenGenerator) Option

WithTokenGenerator sets a custom TokenGenerator that will be called to generate a fresh authentication token for every new connection. This is essential for services like DSQL that require short-lived tokens.

type Pool

type Pool struct {
	*pgxpool.Pool
}

Pool is a thin wrapper around pgxpool.Pool that simplifies creating connection pools.

func NewConnectionPool

func NewConnectionPool(ctx context.Context, connection string, opts ...Option) (*Pool, error)

type TokenGenerator

type TokenGenerator func(ctx context.Context, cfg aws.Config) (string, error)

TokenGenerator is a function type that generates an authentication token.

Jump to

Keyboard shortcuts

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