-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from narma/support_for_lifted_values_zio-1.x
Support for lifted values zio 1.x
- Loading branch information
Showing
8 changed files
with
158 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: [master, main] | ||
branches: [master, main, zio-1.x] | ||
tags: ["*"] | ||
jobs: | ||
publish: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/scala/zio/cassandra/session/cql/InterpolatorValue.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package zio.cassandra.session.cql | ||
|
||
sealed trait InterpolatorValue | ||
|
||
sealed trait CqltValue extends InterpolatorValue | ||
|
||
sealed trait CqlValue extends InterpolatorValue | ||
|
||
object CqlValue { | ||
|
||
// This implicit conversion automatically captures the value and evidence of the Binder in a cql interpolated string | ||
implicit def aToBoundValue[A](a: A)(implicit ev: Binder[A]): BoundValue[A] = | ||
BoundValue(a, ev) | ||
|
||
} | ||
|
||
/** BoundValue is used to capture the value inside the cql interpolated string along with evidence of its Binder so that | ||
* a ParameterizedQuery can be built and the values can be bound to the BoundStatement internally | ||
*/ | ||
final case class BoundValue[A](value: A, ev: Binder[A]) extends CqlValue | ||
|
||
sealed trait Put[T] extends CqltValue | ||
|
||
object Put { | ||
|
||
def apply[T: Binder]: Put[T] = put.asInstanceOf[Put[T]] | ||
|
||
private val put: Put[Any] = new Put[Any] {} | ||
|
||
} | ||
|
||
/** LiftedValue is useful when you want to inject a value into cql query as is without escaping (similar to | ||
* [[zio.cassandra.session.cql.CqlConstInterpolator]], but on a lower lever). <br> Please only use LiftedValue for | ||
* input that you as the application author control. | ||
*/ | ||
final case class LiftedValue(value: Any) extends CqltValue with CqlValue { | ||
|
||
override def toString: String = value.toString // to keep things simple with cqlConst | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters