ls 5 年之前
父节点
当前提交
43411439c5
共有 1 个文件被更改,包括 20 次插入0 次删除
  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
+}