ls 5 lat temu
rodzic
commit
43411439c5
1 zmienionych plików z 20 dodań i 0 usunięć
  1. 20 0
      utils.go

+ 20 - 0
utils.go

@@ -0,0 +1,20 @@
+package myth
+
+import (
+	"encoding/json"
+)
+
+// Map is a shortcut for map[string]interface{}
+type Map map[string]interface{}
+
+// String map to json string
+func (m Map) String() string {
+	bs, _ := json.Marshal(m)
+	return string(bs)
+}
+
+// Bytes map to json bytes
+func (m Map) Bytes() []byte {
+	bs, _ := json.Marshal(m)
+	return bs
+}