You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
880 B

  1. package config
  2. type Mysql struct {
  3. Path string `mapstructure:"path" json:"path" yaml:"path"`
  4. Config string `mapstructure:"config" json:"config" yaml:"config"`
  5. Dbname string `mapstructure:"db-name" json:"dbname" yaml:"db-name"`
  6. Username string `mapstructure:"username" json:"username" yaml:"username"`
  7. Password string `mapstructure:"password" json:"password" yaml:"password"`
  8. MaxIdleConns int `mapstructure:"max-idle-conns" json:"maxIdleConns" yaml:"max-idle-conns"`
  9. MaxOpenConns int `mapstructure:"max-open-conns" json:"maxOpenConns" yaml:"max-open-conns"`
  10. LogMode bool `mapstructure:"log-mode" json:"logMode" yaml:"log-mode"`
  11. LogZap string `mapstructure:"log-zap" json:"logZap" yaml:"log-zap"`
  12. }
  13. func (m *Mysql) Dsn() string {
  14. return m.Username + ":" + m.Password + "@tcp(" + m.Path + ")/" + m.Dbname + "?" + m.Config
  15. }