summaryrefslogtreecommitdiffstats
path: root/model/utils.go
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2017-03-08 01:30:33 +0100
committerJoram Wilander <jwawilander@gmail.com>2017-03-07 19:30:33 -0500
commit19ec4c42989df53279a1e7fe8dc997244ffbb20c (patch)
tree305febf622536ec03b1ef7190b7657be5a244811 /model/utils.go
parentfa75e0e7c45dfd7b72b9fa56dfb4b0ca1496c81c (diff)
downloadchat-19ec4c42989df53279a1e7fe8dc997244ffbb20c.tar.gz
chat-19ec4c42989df53279a1e7fe8dc997244ffbb20c.tar.bz2
chat-19ec4c42989df53279a1e7fe8dc997244ffbb20c.zip
add team exists endpoint for APIv4 (#5517)
Diffstat (limited to 'model/utils.go')
-rw-r--r--model/utils.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/model/utils.go b/model/utils.go
index 08809a47f..8ae45b140 100644
--- a/model/utils.go
+++ b/model/utils.go
@@ -156,6 +156,15 @@ func MapToJson(objmap map[string]string) string {
}
}
+// MapToJson converts a map to a json string
+func MapBoolToJson(objmap map[string]bool) string {
+ if b, err := json.Marshal(objmap); err != nil {
+ return ""
+ } else {
+ return string(b)
+ }
+}
+
// MapFromJson will decode the key/value pair map
func MapFromJson(data io.Reader) map[string]string {
decoder := json.NewDecoder(data)
@@ -168,6 +177,18 @@ func MapFromJson(data io.Reader) map[string]string {
}
}
+// MapFromJson will decode the key/value pair map
+func MapBoolFromJson(data io.Reader) map[string]bool {
+ decoder := json.NewDecoder(data)
+
+ var objmap map[string]bool
+ if err := decoder.Decode(&objmap); err != nil {
+ return make(map[string]bool)
+ } else {
+ return objmap
+ }
+}
+
func ArrayToJson(objmap []string) string {
if b, err := json.Marshal(objmap); err != nil {
return ""