Skip to content

Add values to InsertBuilder

Compare
Choose a tag to compare
@calvinlfer calvinlfer released this 23 Mar 12:40
· 76 commits to zio1 since this release

New additions

We added .values to InsertBuilder to help inserting a lot of columns without having to repeatedly type value

final case class Person(id: Int, name: Option[String], age: Option[Int])
object Person {
  val tableName = "person"
  val Id = "id"
  val Name = "name"
  val Age = "age"
  val AllColumns: NonEmptyChunk[String] = NonEmptyChunk(Id, Name, Age)

  def insert(in: Person): CQL[MutationResult] =
    InsertBuilder(tableName)
      .values(
        Id   -> in.id,
        Name -> in.name,
        Age  -> in.age
      )
      .ifNotExists
      .build
}

What's Changed

Full Changelog: 0.5.4...0.5.5