compojure destructuring make integers ... not integers?

时间:2015-03-06 01:01:19

标签: clojure key compojure datomic

此Compojure GET路由具有硬编码ID ...

   ;posts 
(GET "/post:id" [id :as request]
  ;(str "the post id is... " id)
   (def email (get-in request [:session :ze-auth-email]))
   (vb/post-page-draw email 17592186045616))

作品^

然而,使用符号id(在最后一行)......

   ;posts 
(GET "/post:id" [id :as request]
  ;(str "the post id is... " id)
   (def email (get-in request [:session :ze-auth-email]))
   (vb/post-page-draw email id)

网址是:

localhost:4000/post17592186045616  ;;i.e. the number from above

(编辑:单词post和id之间没有冒号)

返回一个huuuge堆栈跟踪,主要是打破

java.lang.Exception
processing rule: (q__7967 ?title ?content ?tags ?eid), 
message: processing clause: [?eid post/title ?title], 
message: Cannot resolve key: 17592186045616

所以,我已经能够将它隔离到compojure解构只是不喜欢我通过的整数...我怎样才能得到我的(vb / post-page-draw email id )使用通过URL传递的参数?

1 个答案:

答案 0 :(得分:2)

尝试:

(vb/post-page-draw email (Long. id))