database

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

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

Open knows how to open a database connection based on the configuration.

func StatusCheck

func StatusCheck(ctx context.Context, db *sqlx.DB) error

StatusCheck returns nil if it can successfully talk to the database. It returns a non-nil error otherwise.

Types

type Config

type Config struct {
	User         string `mapstructure:"user" yaml:"user" json:"user,omitempty"`
	Password     string `mapstructure:"password" yaml:"password" json:"password,omitempty"`
	Host         string `mapstructure:"host" yaml:"host" json:"host,omitempty"`
	Name         string `mapstructure:"name" yaml:"name" json:"name,omitempty"`
	MaxIdleConns int    `mapstructure:"maxIdleConns" yaml:"maxIdleConns" json:"maxIdleConns,omitempty"`
	MaxOpenConns int    `mapstructure:"maxOpenConns" yaml:"maxOpenConns" json:"maxOpenConns,omitempty"`
	DisableTLS   bool   `mapstructure:"disableTls" yaml:"disableTLS" json:"disableTLS,omitempty"`
}

Config is the required properties to use the database.

type HealthcheckAdapter

type HealthcheckAdapter struct {
	DB *sqlx.DB
}

func NewHealthChecker

func NewHealthChecker(db *sqlx.DB) *HealthcheckAdapter

func (*HealthcheckAdapter) Name

func (h *HealthcheckAdapter) Name() string

func (*HealthcheckAdapter) Pass

func (h *HealthcheckAdapter) Pass() bool

Directories

Path Synopsis
Package dbmigrate contains the database schema, migrations and seeding data.
Package dbmigrate contains the database schema, migrations and seeding data.

Jump to

Keyboard shortcuts

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