-
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 #15 from narma/transform_field_names_in_UdtWrites_…
…zio-1.x transform fieldNames according to configuration in UdtWrites zio 1.x
- Loading branch information
Showing
6 changed files
with
79 additions
and
37 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
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
34 changes: 34 additions & 0 deletions
34
src/it/scala/zio/cassandra/session/cql/codec/UdtWritesSpec.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,34 @@ | ||
package zio.cassandra.session.cql.codec | ||
|
||
import zio.cassandra.session.CassandraSpecUtils | ||
import zio.cassandra.session.cql.CqlStringContext | ||
import zio.cassandra.session.cql.unsafe.lift | ||
import zio.test._ | ||
|
||
object UdtWritesSpec extends CassandraSpecUtils { | ||
|
||
final case class Udt(ALLUPPER: String, alllower: String, someName: String, someLongName: String) | ||
|
||
final case class Data(id: Long, udt: Udt) | ||
|
||
private val data = | ||
Data(0, Udt("ALL-UPPER", "all-lower", "some-name", "some-long-name")) | ||
|
||
val writesTests = suite("UdtWrites")( | ||
testM("should write names as is") { | ||
implicit val configuration: Configuration = Configuration(identity(_)) | ||
|
||
val query = | ||
cql"insert into ${lift(keyspace)}.udt_codec_default_name_test(id, udt) values (${data.id}, ${data.udt})".execute | ||
|
||
query.as(assertCompletes) | ||
}, | ||
testM("should write names transformed to snake_case") { | ||
val query = | ||
cql"insert into ${lift(keyspace)}.udt_codec_snake_name_test(id, udt) values (${data.id}, ${data.udt})".execute | ||
|
||
query.as(assertCompletes) | ||
} | ||
) | ||
|
||
} |
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