Documentation ¶
Index ¶
- Constants
- Variables
- func Connect(opts ...Option) error
- func GetDB(ctx context.Context, name ...string) *gorm.DB
- type Config
- type Option
- func Database(database string) Option
- func Host(host string) Option
- func LogLevel(level string) Option
- func MaxIdleConn(num int) Option
- func MaxLifeTime(t int32) Option
- func MaxOpenConn(num int) Option
- func Metrics(b bool) Option
- func Name(name string) Option
- func Password(password string) Option
- func Port(port int32) Option
- func Trace(b bool) Option
- func Username(username string) Option
- type Options
Constants ¶
View Source
const ( Silent = "silent" Warn = "warn" Error = "error" Info = "info" )
Variables ¶
View Source
var (
Default = "default"
)
Functions ¶
Types ¶
type Options ¶
type Options struct { Name string `json:"name" mapstructure:"name"` Host string `json:"host" mapstructure:"host"` Port int32 `json:"port" mapstructure:"port"` Username string `json:"username" mapstructure:"username"` Password string `json:"password" mapstructure:"password"` Database string `json:"database" mapstructure:"database"` MaxIdleConn int `json:"max_idle_conn" mapstructure:"max_idle_conn"` MaxOpenConn int `json:"max_open_conn" mapstructure:"max_open_conn"` LogLevel string `json:"log_level" mapstructure:"log_level"` MaxLifeTime int32 `json:"max_life_time" mapstructure:"max_life_time"` Metrics bool `json:"metrics" mapstructure:"metrics"` Trace bool `json:"trace" mapstructure:"trace"` }
func NewOptions ¶
Click to show internal directories.
Click to hide internal directories.