Last active
May 25, 2024 10:20
-
-
Save dacr/01df233da9014dd45e7af15ceac83ce8 to your computer and use it in GitHub Desktop.
chimney simplest usage example / published by https://github.com/dacr/code-examples-manager #d518a36f-c696-46b2-b777-14af2a19a562/c596c4bd400e5282592ed5cf949ab4539c040158
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
// summary : chimney simplest usage example | |
// keywords : scala, chimney, @testable | |
// publish : gist | |
// authors : chimney | |
// license : Apache2 | |
// id : d518a36f-c696-46b2-b777-14af2a19a562 | |
// created-on : 2023-06-23T16:20:02+02:00 | |
// managed-by : https://github.com/dacr/code-examples-manager | |
// run-with : scala-cli $file | |
//> using scala "3.4.2" | |
//> using dep "io.scalaland::chimney:0.8.0-M1" | |
import io.scalaland.chimney.dsl._ | |
case class Foo(x: String, y: Int, z: Boolean = true) | |
case class Bar(x: String, y: Int) | |
println(Foo("abc", 10).transformInto[Bar]) | |
println(Bar("abc", 10).into[Foo].enableDefaultValues.transform) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment