Няма описание
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.

database_config.go 720B

12345678910111213141516171819202122232425262728293031323334
  1. package subconfigs
  2. import "git.x2erp.com/qdy/go-base/config/core"
  3. // DatabaseConfig 单个数据库配置
  4. type DatabaseConfig struct {
  5. core.BaseConfig
  6. DbConfig `yaml:",inline" desc:"数据库连接配置"`
  7. }
  8. // consul.go
  9. func (c *DatabaseConfig) Description() string {
  10. return "数据库连接配置"
  11. }
  12. func (c *DatabaseConfig) SetDefaults() {
  13. SetDbDefaults(&c.DbConfig)
  14. }
  15. func (c *DatabaseConfig) Load(data map[string]interface{}) error {
  16. return c.LoadFromYAML(data, c)
  17. }
  18. func (c *DatabaseConfig) Validate() error {
  19. return ValidateDbConfig(&c.DbConfig)
  20. }
  21. func (c *DatabaseConfig) IsConfigured() bool {
  22. return IsDbConfigured(&c.DbConfig, "")
  23. }
  24. func init() {
  25. core.Register("database", &DatabaseConfig{})
  26. }