Skip to content

Instantly share code, notes, and snippets.

@paomian
Last active August 29, 2015 14:22
Show Gist options
  • Save paomian/b24b7c0548a910b5d2c8 to your computer and use it in GitHub Desktop.
Save paomian/b24b7c0548a910b5d2c8 to your computer and use it in GitHub Desktop.
;; hash map 数据处理
(pre-process {:deviceToken "abcdefghi" :channel ["a" "b" "c"]}
[:deviceToken :channel :_Installattion] nil)
[{
"_Installattion<>":"",
"channel":["a","b","c"],
"channel=a":1,
"channel=b":1,
"channel=c":1,
"deviceToken":"abcdefghi"
} 0]
;; sort set 数据处理
(pre-process {:deviceToken "abcdefghi" :channel ["a" "b" "c"] :score 100}
[:deviceToken :channel :_Installattion] :score)
[100.0 {
"_Installattion<>":"",
"channel":["a","b","c"],
"channel=a":1,
"channel=b":1,
"channel=c":1,
"deviceToken":"abcdefghi"
}]
;;生成中间匹配字符串
(json2str {:deviceToken {:$in ["a" "b"]}} "*")
("*deviceToken=a\":1*" "*deviceToken=b\":1*")
(json2str {:deviceToken "abcder"} "*")
"*deviceToken\":\"abcder*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment