Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for lifted values #11

Merged
merged 2 commits into from
Jul 26, 2022
Merged

add support for lifted values #11

merged 2 commits into from
Jul 26, 2022

Conversation

myazinn
Copy link
Collaborator

@myazinn myazinn commented Jul 23, 2022

Currently if we want to store things like table name in a variable, we cannot do something like this

val tableName = "my_table"
val id = 1
val query = cql"select id from $tableName where id = $id".as[Int]

We have to do either this

val tableName = "my_table"
val id = 1
val query = (cqlConst"select id from $tableName" ++  cql"where id = $id").as[Int]

Or this

val tableName = "my_table"
val id = 1
val query = (cql"select id from" + tableName ++  cql"where id = $id").as[Int]

This MR adds new syntax for such cases

import unsafe._

val tableName = "my_table"
val id = 1
val query = cql"select id from ${lift(tableName)} where id = $id".as[Int]

Support for it was added for ll three types of string interpolation (cqlConst, cql, cqlt).

@narma narma self-requested a review July 23, 2022 21:00
narma
narma previously approved these changes Jul 23, 2022
@myazinn myazinn merged commit 5d0e419 into master Jul 26, 2022
@narma narma deleted the support_for_lifted_values branch July 26, 2022 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants