Hi if a declare lens asResult can I pass it the me...
# http4k
r
Hi if a declare lens asResult can I pass it the meta or I have to make a lens then a result and pass the lens to the receiving .
d
the description occurs in the API before the conversion to a Result.
Copy code
Query.required("name", "description").asResult()
r
Sorry i did not explain myself well. If i got a result:
Copy code
val nameResult = Query.required("name", "description").asResult()
Can I use this in the ContractRoute
meta
Copy code
meta {
  queries += nameResult
}
or do I have to declare apart:
Copy code
val nameLens = Query.required("name", "description")
val nameResult = nameLens.asResult()

neta {
   queries += nameLens
}
So the question is can I only declare the result then is possible to pass it in the meta or a way to get from the result the Lens to avoid using the double declaration of variables.
d
Ah - no you can’t. Sorry. You can however just create the base lens and then call asResult() on it after you’ve put it into the meta block. Or call it every time before you extract.
r
Ok thanks