diff options
Diffstat (limited to 'store/sql_system_store.go')
-rw-r--r-- | store/sql_system_store.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/store/sql_system_store.go b/store/sql_system_store.go index f8da06cec..a2b4f6396 100644 --- a/store/sql_system_store.go +++ b/store/sql_system_store.go @@ -114,3 +114,24 @@ func (s SqlSystemStore) Get() StoreChannel { return storeChannel } + +func (s SqlSystemStore) GetByName(name string) StoreChannel { + + storeChannel := make(StoreChannel) + + go func() { + result := StoreResult{} + + var system model.System + if err := s.GetReplica().SelectOne(&system, "SELECT * FROM Systems WHERE Name = :Name", map[string]interface{}{"Name": name}); err != nil { + result.Err = model.NewLocAppError("SqlSystemStore.GetByName", "store.sql_system.get_by_name.app_error", nil, "") + } + + result.Data = &system + + storeChannel <- result + close(storeChannel) + }() + + return storeChannel +} |