mysql

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts *Options) (*gorm.DB, error)

New returns a new gorm db instance with specified options.

Types

type Options

type Options struct {
	Host                  string        `json:"host,omitempty"                     mapstructure:"host"`
	Username              string        `json:"username,omitempty"                 mapstructure:"username"`
	Password              string        `json:"-"                                  mapstructure:"password"`
	Database              string        `json:"database"                           mapstructure:"database"`
	MaxIdleConnections    int           `json:"max-idle-connections,omitempty"     mapstructure:"max-idle-connections"`
	MaxOpenConnections    int           `json:"max-open-connections,omitempty"     mapstructure:"max-open-connections"`
	MaxConnectionLifeTime time.Duration `json:"max-connection-life-time,omitempty" mapstructure:"max-connection-life-time"`
	SlowThreshold         time.Duration `json:"slow-threshold,omitempty"           mapstructure:"slow-threshold"`
	LogLevel              int           `json:"log-level"                          mapstructure:"log-level"`
}

Options defines options for mysql database.

func NewOptions

func NewOptions() *Options

NewOptions create a new options instance.

func (*Options) AddFlags

func (o *Options) AddFlags(fs *pflag.FlagSet)

AddFlags adds flags related to mysql storage for a specific APIServer to the specified FlagSet.

func (*Options) Validate

func (o *Options) Validate() []error

Validate verifies flags passed to Options.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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