Skip to content

Commit

Permalink
- fixed problem wit optional newtypes (#120)
Browse files Browse the repository at this point in the history
Co-authored-by: Aleksandr Shabalin <[email protected]>
  • Loading branch information
alexshabal and Aleksandr Shabalin authored Dec 5, 2024
1 parent b950fbb commit 2f17197
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions src/main/scala/com/ringcentral/cassandra4io/cql/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,31 @@ package object cql {
override def binder: Binder[RT] = f.binder
}

implicit def hConsBindableValuesBuilder[V[_] <: Values[_], T: ColumnsValues, PT <: HList, RT <: HList](implicit
implicit def hConsBindableValuesBuilder[T: ColumnsValues, PT <: HList, RT <: HList](implicit
f: BindableBuilder.Aux[PT, RT]
): BindableBuilder.Aux[V[T] :: PT, T :: RT] = new BindableBuilder[V[T] :: PT] {
): BindableBuilder.Aux[Values[T] :: PT, T :: RT] = new BindableBuilder[Values[T] :: PT] {
override type Repr = T :: RT
override def binder: Binder[T :: RT] = {
implicit val hBinder: Binder[T] = Values[T].binder
implicit val tBinder: Binder[RT] = f.binder
Binder[T :: RT]
}
}

implicit def hConsBindableEqualsToBuilder[T: ColumnsValues, PT <: HList, RT <: HList](implicit
f: BindableBuilder.Aux[PT, RT]
): BindableBuilder.Aux[EqualsTo[T] :: PT, T :: RT] = new BindableBuilder[EqualsTo[T] :: PT] {
override type Repr = T :: RT
override def binder: Binder[T :: RT] = {
implicit val hBinder: Binder[T] = Values[T].binder
implicit val tBinder: Binder[RT] = f.binder
Binder[T :: RT]
}
}

implicit def hConsBindableAssignmentsBuilder[T: ColumnsValues, PT <: HList, RT <: HList](implicit
f: BindableBuilder.Aux[PT, RT]
): BindableBuilder.Aux[Assignment[T] :: PT, T :: RT] = new BindableBuilder[Assignment[T] :: PT] {
override type Repr = T :: RT
override def binder: Binder[T :: RT] = {
implicit val hBinder: Binder[T] = Values[T].binder
Expand Down

0 comments on commit 2f17197

Please sign in to comment.