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

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