110 lines
2.2 KiB
Go
110 lines
2.2 KiB
Go
package config
|
|
|
|
type postgresConfig struct {
|
|
Host string `json:"host" yaml:"host"`
|
|
Port int `json:"port" yaml:"port"`
|
|
User string `json:"user" yaml:"user"`
|
|
Password string `json:"password" yaml:"password"`
|
|
DBName string `json:"dbname" yaml:"dbname"`
|
|
SSLMode string `json:"sslmode" yaml:"sslmode"`
|
|
TimeZone string `json:"timezone" yaml:"timezone"`
|
|
}
|
|
|
|
func (config *postgresConfig) GetHost() string {
|
|
if config == nil {
|
|
panic("postgres config is nil")
|
|
}
|
|
return config.Host
|
|
}
|
|
|
|
func (config *postgresConfig) SetHost(host string) {
|
|
if config == nil {
|
|
panic("postgres config is nil")
|
|
}
|
|
config.Host = host
|
|
}
|
|
|
|
func (config *postgresConfig) GetPort() int {
|
|
if config == nil {
|
|
panic("postgres config is nil")
|
|
}
|
|
return config.Port
|
|
}
|
|
|
|
func (config *postgresConfig) SetPort(port int) {
|
|
if config == nil {
|
|
panic("postgres config is nil")
|
|
}
|
|
config.Port = port
|
|
}
|
|
|
|
func (config *postgresConfig) GetUser() string {
|
|
if config == nil {
|
|
panic("postgres config is nil")
|
|
}
|
|
return config.User
|
|
}
|
|
|
|
func (config *postgresConfig) SetUser(user string) {
|
|
if config == nil {
|
|
panic("postgres config is nil")
|
|
}
|
|
config.User = user
|
|
}
|
|
|
|
func (config *postgresConfig) GetPassword() string {
|
|
if config == nil {
|
|
panic("postgres config is nil")
|
|
}
|
|
return config.Password
|
|
}
|
|
|
|
func (config *postgresConfig) SetPassword(password string) {
|
|
if config == nil {
|
|
panic("postgres config is nil")
|
|
}
|
|
config.Password = password
|
|
}
|
|
|
|
func (config *postgresConfig) GetDBName() string {
|
|
if config == nil {
|
|
panic("postgres config is nil")
|
|
}
|
|
return config.DBName
|
|
}
|
|
|
|
func (config *postgresConfig) SetDBName(dbName string) {
|
|
if config == nil {
|
|
panic("postgres config is nil")
|
|
}
|
|
config.DBName = dbName
|
|
}
|
|
|
|
func (config *postgresConfig) GetSSLMode() string {
|
|
if config == nil {
|
|
panic("postgres config is nil")
|
|
}
|
|
return config.SSLMode
|
|
}
|
|
|
|
func (config *postgresConfig) SetSSLMode(sslMode string) {
|
|
if config == nil {
|
|
panic("postgres config is nil")
|
|
}
|
|
config.SSLMode = sslMode
|
|
}
|
|
|
|
func (config *postgresConfig) GetTimeZone() string {
|
|
if config == nil {
|
|
panic("postgres config is nil")
|
|
}
|
|
return config.TimeZone
|
|
}
|
|
|
|
func (config *postgresConfig) SetTimeZone(timeZone string) {
|
|
if config == nil {
|
|
panic("postgres config is nil")
|
|
}
|
|
config.TimeZone = timeZone
|
|
}
|