aplication.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package config
  2. // GinConfig 定义 Gin 配置文件的结构体
  3. type GinConfig struct {
  4. Host string `mapstructure:"host"`
  5. Port int `mapstructure:"port"`
  6. }
  7. // MySQLConfig 定义 mysql 配置文件结构体
  8. type MySQLConfig struct {
  9. Host string `mapstructure:"host"`
  10. Port int `mapstructure:"port"`
  11. Username string `mapstructure:"username"`
  12. Password string `mapstructure:"password"`
  13. DBname string `mapstructure:"db_name"`
  14. MaxOpenConns int `mapstructure:"max_open_conns"`
  15. MaxIdleConns int `mapstructure:"max_idle_conns"`
  16. }
  17. // RedisConfig 定义 redis 配置文件结构体
  18. type RedisConfig struct {
  19. Host string `mapstructure:"host"`
  20. Port int `mapstructure:"port"`
  21. Password string `mapstructure:"password"`
  22. DB int `mapstructure:"db"`
  23. PoolSize int `mapstructure:"pool_size"`
  24. }
  25. // OssConfig 定义oss结构体
  26. type OssConfig struct {
  27. Key string `mapstructure:"key"`
  28. Secret string `mapstructure:"secret"`
  29. Endpoint string `mapstructure:"endpoint"`
  30. Bucket string `mapstructure:"bucket"`
  31. }
  32. // SnowflakeConfig 定义雪花算法接口结构
  33. // SnowflakeConfig 定义雪花算法接口结构体
  34. type SnowFlakeConfig struct {
  35. MechineId int64 `mapstructure:"mechineid"`
  36. }
  37. // System 定义项目配置文件结构体
  38. GinConfig *GinConfig `mapstructure:"gin"`
  39. MySQLConfig *MySQLConfig `mapstructure:"mysql"`
  40. RedisConfig *RedisConfig `mapstructure:"redis"`
  41. OssConfig *OssConfig `mapstructure:"oss"`
  42. OssConfig *OssConfig `mapstructure:"oss"`
  43. SnowFlakeConfig *SnowFlakeConfig `mapstructure:"snowflake"`
  44. }