configs.go 513 B

123456789101112131415161718192021222324252627
  1. package configs
  2. //配置文件序列化对象
  3. type Config struct {
  4. Mysql Mysql `mapstructure:"mysql"`
  5. Redis Redis
  6. }
  7. type Mysql struct {
  8. Host string `mapstructure:"host"`
  9. Port int `mapstructure:"port"`
  10. Username string `mapstructure:"username"`
  11. Password string `mapstructure:"password"`
  12. Database string `mapstructure:"database"`
  13. Charset string `mapstructure:"charset"`
  14. }
  15. type Redis struct {
  16. Host string
  17. Password string
  18. Db int64
  19. }
  20. func NewConfig() *Config {
  21. return &Config{}
  22. }