datasource

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConnection

func NewConnection(resolver *dialector.Resolver, p *Properties) (*gorm.DB, error)

func NewHealthChecker

func NewHealthChecker(connection *sql.DB) actuator.HealthChecker

func NewInformer

func NewInformer(connection *sql.DB) actuator.Informer

Types

type HealthChecker

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

func (HealthChecker) Check

func (HealthChecker) Component

func (h HealthChecker) Component() string

type Informer

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

func (Informer) Key

func (d Informer) Key() string

func (Informer) Value

func (d Informer) Value() interface{}

type Properties

type Properties struct {
	Driver   string `validate:"required"`
	Dsn      string `validate:"required_without_all=Host Port Database Username"`
	Host     string `validate:"required_without=Dsn"`
	Port     int    `validate:"required_without=Dsn"`
	Database string `validate:"required_without=Dsn"`
	Username string `validate:"required_without=Dsn"`
	Password string
	Params   string

	// The maximum number of open connections to the database.
	MaxOpenConns int `default:"10"`

	// The maximum amount of time a connection may be reused.
	ConnMaxLifetime time.Duration `default:"30m"`

	// The maximum number of connections in the idle connection pool.
	MaxIdleConns int `default:"2"`

	// The maximum amount of time a connection may be idle.
	ConnMaxIdleTime time.Duration `default:"10m"`

	// The log level of gorm. There are four levels: "SILENT", "ERROR", "WARN", "INFO".
	LogLevel string `default:"SILENT"`
}

func NewProperties

func NewProperties(loader config.Loader) (*Properties, error)

func (Properties) Prefix

func (p Properties) Prefix() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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