" />
开发者

Lift Req object

开发者 https://www.devze.com 2023-01-09 10:06 出处:网络
in liftbook, there\'s an example of creating of a Req instance by using apply : case Req(List(\"api\", \"expense\", eid), \"\", GetRequest) =>

in liftbook, there's an example of creating of a Req instance by using apply :

case Req(List("api", "expense", eid), "", GetRequest) =>
 () => showExpense(eid)
but when I look into api documentation, there are two apply() methods, but I don't know which one and how is ran in this example.

Also, is there a way, how to include /a/b and /a/b/c r开发者_JAVA技巧equests with one case ?

Also, is there a way, how to enumerate all possible requests in one case : guess : case Req(List("api", "expense", eid), "", {GetRequest,PostRequest})?

Thanks for answering.


Judging by case, this isn't an example of creating a Req, but an example of pattern matching one.

Also, is there a way, how to enumerate all possible requests in one case

It should be

case Req(List("api", "expense", eid), "", _)


I think you'd have to have a two tier pattern matching. On that would match the Req with any Request and extracts the request, and another that matches the specific request.

0

精彩评论

暂无评论...
验证码 换一张
取 消