postgresconn

package module
v0.0.0-...-cef6852 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(cfg Config) (*sqlx.DB, error)

Types

type Config

type Config struct {
	Host           string      `validate:"required"`
	Port           uint16      `validate:"required"`
	Database       string      `validate:"required"`
	User           string      `validate:"required"`
	Password       string      `validate:"required"`
	TLSConfig      *tls.Config // nil disables TLS
	ConnectTimeout int         `validate:"required"` // seconds
}

func (*Config) String

func (c *Config) String() string

type Conn

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

func New

func New(cfg Config) (*Conn, error)

func (*Conn) DB

func (c *Conn) DB() *sqlx.DB

func (*Conn) GetName

func (c *Conn) GetName() string

func (*Conn) Start

func (c *Conn) Start(_ context.Context) error

func (*Conn) Stop

func (c *Conn) Stop(_ context.Context) error

Jump to

Keyboard shortcuts

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