gorm.go 864 B

12345678910111213141516171819202122232425262728293031
  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. }
  18. type Postgresql struct {
  19. Host string `mapstructure:"host"`
  20. Port string `mapstructure:"port"`
  21. User string `mapstructure:"user"`
  22. Password string `mapstructure:"password"`
  23. Dbname string `mapstructure:"dbname"`
  24. Sslmode string `mapstructure:"sslmode"` // "disable", "require", "verify-ca", "verify-full"
  25. TimeZone string `mapstructure:"time-zone"` // e.g., "Asia/Shanghai"
  26. }