1
0
forked from MTSR/mapserver
mapserver/server/mapobjectdb/postgres/settings.go
NatureFreshMilk fba3f118d8 fix #19
2019-03-21 15:07:09 +01:00

29 lines
489 B
Go

package postgres
func (db *PostgresAccessor) GetSetting(key string, defaultvalue string) (string, error) {
rows, err := db.db.Query(getSettingQuery, key)
if err != nil {
return "", err
}
defer rows.Close()
value := defaultvalue
if rows.Next() {
err = rows.Scan(&value)
if err != nil {
return "", err
}
}
return value, nil
}
func (db *PostgresAccessor) SetSetting(key string, value string) error {
_, err := db.db.Exec(setSettingQuery, key, value)
return err
}