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

TupleBinder fails to bind #121

Closed
tkrs opened this issue Dec 4, 2019 · 0 comments · Fixed by #122
Closed

TupleBinder fails to bind #121

tkrs opened this issue Dec 4, 2019 · 0 comments · Fixed by #122
Assignees
Labels

Comments

@tkrs
Copy link
Collaborator

tkrs commented Dec 4, 2019

TupleBinder is automatically generated as follows:

trait TupleBinder {

  implicit def tuple1Binder[A](implicit
    a: RowSerializer[A]
  ): Binder[Tuple1[A]] =
    new Binder[Tuple1[A]] {
      def apply(bound: BoundStatement, ver: ProtocolVersion, xs: Tuple1[A]): Result[BoundStatement] =
        (a(bound, 0, xs._1, ver)).map(_ => bound)
    }

  implicit def tuple2Binder[A, B](implicit
    a: RowSerializer[A], b: RowSerializer[B]
  ): Binder[(A, B)] =
    new Binder[(A, B)] {
      def apply(bound: BoundStatement, ver: ProtocolVersion, xs: (A, B)): Result[BoundStatement] =
        (a(bound, 0, xs._1, ver) *> b(bound, 1, xs._2, ver)).map(_ => bound)
    }

  implicit def tuple3Binder[A, B, C](implicit
    a: RowSerializer[A], b: RowSerializer[B], c: RowSerializer[C]
  ): Binder[(A, B, C)] =
    new Binder[(A, B, C)] {
      def apply(bound: BoundStatement, ver: ProtocolVersion, xs: (A, B, C)): Result[BoundStatement] =
        (a(bound, 0, xs._1, ver) *> b(bound, 1, xs._2, ver) *> c(bound, 2, xs._3, ver)).map(_ => bound)
    }

  // ...
}

Even though BoundStatement has been immutable since 4.0, all bind operations are discarded because the passed bound is always returned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant