Skip to content

ducktape 0.2.7

Latest
Compare
Choose a tag to compare
@arainko arainko released this 30 Dec 10:24
· 8 commits to series/0.2.x since this release
20c5e60

ducktape 0.2.7

This release brings two new config options: Field.computedDeep and Field.fallibleComputedDeep that allows you to compute a field by using the closest possible source value:

 case class SourceToplevel1(level1: Option[SourceLevel1])
    case class SourceLevel1(level2: Option[SourceLevel2])
    case class SourceLevel2(level3: SourceLevel3)
    case class SourceLevel3(int: Int)

    case class DestToplevel1(level1: Option[DestLevel1])
    case class DestLevel1(level2: Option[DestLevel2])
    case class DestLevel2(level3: Option[DestLevel3])
    case class DestLevel3(int: Long)

    val source = SourceToplevel1(Some(SourceLevel1(Some(SourceLevel2(SourceLevel3(1))))))
    val expected = DestToplevel1(Some(DestLevel1(Some(DestLevel2(Some(DestLevel3(11)))))))

    assertTransformsConfigured(source, expected)(
      Field.computedDeep(_.level1.element.level2.element.level3.element.int, (int: Int) => int.toLong + 10)
    )

while also 'cutting through' Options, collections and other things that disallowed using 'Field.computed' in the past.

What's Changed

Full Changelog: v0.2.6...v0.2.7