gorm.go 941 B

1234567891011121314151617181920212223242526272829303132
  1. package config
  2. const (
  3. TypeSqlite = "sqlite"
  4. TypeMysql = "mysql"
  5. TypePostgresql = "postgresql"
  6. )
  7. type Gorm struct {
  8. Type string `mapstructure:"type"`
  9. MaxIdleConns int `mapstructure:"max-idle-conns"`
  10. MaxOpenConns int `mapstructure:"max-open-conns"`
  11. }
  12. type Mysql struct {
  13. Addr string `mapstructure:"addr"`
  14. Username string `mapstructure:"username"`
  15. Password string `mapstructure:"password"`
  16. Dbname string `mapstructure:"dbname"`
  17. Tls string `mapstructure:"tls"` // true / false / skip-verify / custom
  18. }
  19. type Postgresql struct {
  20. Host string `mapstructure:"host"`
  21. Port string `mapstructure:"port"`
  22. User string `mapstructure:"user"`
  23. Password string `mapstructure:"password"`
  24. Dbname string `mapstructure:"dbname"`
  25. Sslmode string `mapstructure:"sslmode"` // "disable", "require", "verify-ca", "verify-full"
  26. TimeZone string `mapstructure:"time-zone"` // e.g., "Asia/Shanghai"
  27. }