summaryrefslogtreecommitdiffstats
path: root/model/status.go
diff options
context:
space:
mode:
Diffstat (limited to 'model/status.go')
-rw-r--r--model/status.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/model/status.go b/model/status.go
index e38f43fe4..59115b42d 100644
--- a/model/status.go
+++ b/model/status.go
@@ -45,6 +45,26 @@ func StatusFromJson(data io.Reader) *Status {
}
}
+func StatusListToJson(u []*Status) string {
+ b, err := json.Marshal(u)
+ if err != nil {
+ return ""
+ } else {
+ return string(b)
+ }
+}
+
+func StatusListFromJson(data io.Reader) []*Status {
+ decoder := json.NewDecoder(data)
+ var statuses []*Status
+ err := decoder.Decode(&statuses)
+ if err == nil {
+ return statuses
+ } else {
+ return nil
+ }
+}
+
func StatusMapToInterfaceMap(statusMap map[string]*Status) map[string]interface{} {
interfaceMap := map[string]interface{}{}
for _, s := range statusMap {