db

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, host string, port uint16, database, username, password string, options ...Option) (*DB, error)

func (*DB) Close added in v0.2.0

func (db *DB) Close()

func (*DB) Conn added in v0.2.0

func (db *DB) Conn(ctx context.Context) (c *pgx.Conn, closer func(), err error)

func (*DB) Tx added in v0.2.0

func (db *DB) Tx(ctx context.Context) (tx pgx.Tx, closer func(error) error, err error)

type Option added in v0.2.0

type Option func(*Options) error

func WithConnTimeout added in v0.2.0

func WithConnTimeout(connTimeout time.Duration) Option

func WithMigrationsFs added in v0.2.0

func WithMigrationsFs(migrationsFs fs.FS) Option

func WithSSL added in v0.2.0

func WithSSL(ssl SSLMode) Option

func WithVersionTable added in v0.2.0

func WithVersionTable(versionTable string) Option

type Options added in v0.2.0

type Options struct {
	// contains filtered or unexported fields
}

type SSLMode added in v0.2.0

type SSLMode string
const (
	SSLModeDisable    SSLMode = "disable"
	SSLModeRequire    SSLMode = "require"
	SSLModeVerifyCA   SSLMode = "verify-ca"
	SSLModeVerifyFull SSLMode = "verify-full"
	SSLModePreferred  SSLMode = "prefer"
)

func (*SSLMode) MarshalText added in v0.2.0

func (s *SSLMode) MarshalText() ([]byte, error)

implemets encoding.TextMarshaler and TextUnmarshaler

func (SSLMode) String added in v0.2.0

func (s SSLMode) String() string

implement fmt.Stringer

func (*SSLMode) UnmarshalText added in v0.2.0

func (s *SSLMode) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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