@pootler has joined the channel
so i just changed (limit num)
to (limit ,num)
and things went from not working, to working, but ive no idea why ….
it unquotes ?
Yep
(define (random-recipe num)
(in-entities conn
(~> (from recipe #:as u)
(order-by ([(random)]))
(limit ,num))))
but i hadnt quoted anything ???
Mysterious
ohhhh
->
is a seperate thread .
is it something to do with realising the value of the variable before throwing the code to another thread maybe ?
Sorry you’ve reached the limit of my knowledge. :grin:
@chris613 Since limit
is a macro it can use ,
as it wants:
yeah i was just comming to that conclusion/guess
and the section of deta docs that explains it :slightly_smiling_face:
Any time the query combinators encounter an unquote, that value gets replaced with a placeholder node in the query AST and, when the query is eventually executed, the value is bound to its prepared statement. This makes it safe and easy to parameterize your queries without having to worry about SQL injection attacks.
for anyone else’s future refernece :slightly_smiling_face:
@shawsumma060 has joined the channel