1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-18 09:35:25 +02:00
focalboard/server/services/store/sqlstore/system.go

39 lines
691 B
Go
Raw Normal View History

package sqlstore
func (s *SQLStore) GetSystemSettings() (map[string]string, error) {
2020-10-20 20:00:46 +02:00
query := s.getQueryBuilder().Select("*").From("system_settings")
2020-10-20 20:00:46 +02:00
rows, err := query.Query()
if err != nil {
return nil, err
}
defer rows.Close()
results := map[string]string{}
for rows.Next() {
var id string
var value string
err := rows.Scan(&id, &value)
if err != nil {
return nil, err
}
results[id] = value
}
return results, nil
}
func (s *SQLStore) SetSystemSetting(id string, value string) error {
2020-10-20 20:00:46 +02:00
query := s.getQueryBuilder().Insert("system_settings").Columns("id", "value").Values(id, value)
2020-10-20 20:00:46 +02:00
_, err := query.Exec()
if err != nil {
return err
}
return nil
}