neo4j-core icon indicating copy to clipboard operation
neo4j-core copied to clipboard

.set(...) with a string parameter

Open ProGM opened this issue 9 years ago • 2 comments

I noticed that it's possible to do:

query.where('q.name = ?', 'something')

But not:

query.set('q.name = ?', 'something')

It could be useful in this case:

query.set('q.score = COALESCE(q.score, 0) * ?', 5)

ProGM avatar Dec 21 '15 20:12 ProGM

Yeah, I could definitely see that. For now if you want to protect against injection you can use params:

query.set('q.score = COALESCE(q.score, 0) * {score_multiplier}').params(score_multiplier: 5}

More awkward, I know

cheerfulstoic avatar Dec 22 '15 03:12 cheerfulstoic

Uhm, at least you should improve the documentation for it, I think!

But it does the trick, thanks!

ProGM avatar Dec 22 '15 08:12 ProGM