io.scalaland.chimney.syntax

Members list

Extensions

Extensions

extension [A](`try`: Try[A])
transparent inline def toPartialResult: Result[A]

Converts Try to Result, using Throwable from Failure as failed result.

Converts Try to Result, using Throwable from Failure as failed result.

Attributes

Returns

successful result if scala.util.Success, failed result with Throwable if scala.util.Failure

Since

0.7.0

extension [A](a: A)
inline def matching[B <: A]: B

Allows paths like _.adt.matching[Subtype].field when selecting the target fields to override in Chimney DSL.

Allows paths like _.adt.matching[Subtype].field when selecting the target fields to override in Chimney DSL.

It can only be used within .withField* methods where the macros reads it and erases it from the final code!

Type parameters

B

subtype for which override should be provided

Attributes

Returns

stubs a value of selected subtype

Since

1.0.0

inline def matchingLeft[LV, RV, L, R](implicit ev: Of[A, LV, RV, L, R]): LV

Allows paths like _.either.matchingLeft.field when selecting the target fields to override in Chimney DSL.

Allows paths like _.either.matchingLeft.field when selecting the target fields to override in Chimney DSL.

It can only be used within .withField* methods where the macros reads it and erases it from the final code!

Attributes

Returns

stubs a value extracted from Left

Since

1.0.0

inline def matchingRight[LV, RV, L, R](implicit ev: Of[A, LV, RV, L, R]): RV

Allows paths like _.either.matchingRight.field when selecting the target fields to override in Chimney DSL.

Allows paths like _.either.matchingRight.field when selecting the target fields to override in Chimney DSL.

It can only be used within .withField* methods where the macros reads it and erases it from the final code!

Attributes

Returns

stubs a value extracted from Right

Since

1.0.0

inline def matchingSome[SV, S](implicit ev: Of[A, SV, S]): SV

Allows paths like _.optional.matchingSome.field when selecting the target fields to override in Chimney DSL.

Allows paths like _.optional.matchingSome.field when selecting the target fields to override in Chimney DSL.

It can only be used within .withField* methods where the macros reads it and erases it from the final code!

Attributes

Returns

stubs a value extracted from Some

Since

1.0.0

extension [C[_], I](cc: C[I])
inline def everyItem(implicit ev: Of[C[I], I]): I

Allows paths like _.collection.everyItem.field when selecting the target fields to override in Chimney DSL.

Allows paths like _.collection.everyItem.field when selecting the target fields to override in Chimney DSL.

It can only be used within .withField* methods where the macros reads it and erases it from the final code!

Attributes

Returns

stubs an item extracted from the collection

Since

1.0.0

extension [M[_, _], K, V](cc: M[K, V])
inline def everyMapKey(implicit ev: Of[M[K, V], K, V]): K

Allows paths like _.map.everyMapKey.field when selecting the target fields to override in Chimney DSL.

Allows paths like _.map.everyMapKey.field when selecting the target fields to override in Chimney DSL.

It can only be used within .withField* methods where the macros reads it and erases it from the final code!

Attributes

Returns

stubs a key extracted from the map

Since

1.0.0

inline def everyMapValue(implicit ev: Of[M[K, V], K, V]): V

Allows paths like _.map.everyMapValue.field when selecting the target fields to override in Chimney DSL.

Allows paths like _.map.everyMapValue.field when selecting the target fields to override in Chimney DSL.

It can only be used within .withField* methods where the macros reads it and erases it from the final code!

Attributes

Returns

stubs a value extracted from the map

Since

1.0.0

extension [A](either: Either[String, A])
transparent inline def toPartialResult: Result[A]

Converts Either to Result, using an error message from Left as failed result.

Converts Either to Result, using an error message from Left as failed result.

Attributes

Returns

successful result if scala.Right, failed result with an error message if scala.Left

Since

0.7.0

extension [A](obj: A)
transparent inline def patchUsing[Patch](patch: Patch)(implicit patcher: Patcher[A, Patch]): A

Performs in-place patching of wrapped object with provided value.

Performs in-place patching of wrapped object with provided value.

If you want to customize patching behavior, consider using using method.

Type parameters

Patch

type of patch object

Value parameters

patch

patch object value

patcher

implicit instance of io.scalaland.chimney.Patcher type class

Attributes

Returns

patched value

See also

io.scalaland.chimney.auto#deriveAutomaticPatcher for default implicit instance

Since

0.4.0

extension [A](option: Option[A])
transparent inline def toPartialResult: Result[A]

Converts Option to Result, using EmptyValue error if None.

Converts Option to Result, using EmptyValue error if None.

Attributes

Returns

successful result if scala.Some, failed result with EmptyValue error if None

Since

0.7.0

transparent inline def toPartialResultOrString(ifEmpty: => String): Result[A]

Converts Option to Result, using provided error message if None.

Converts Option to Result, using provided error message if None.

Value parameters

ifEmpty

lazy error message for scala.None

Attributes

Returns

successful result if scala.Some, failed result with provided error message if scala.None

Since

0.7.0

extension [From](source: From)
transparent inline def transformInto[To](implicit transformer: Transformer[From, To]): To

Performs in-place transformation of captured source value to target type.

Performs in-place transformation of captured source value to target type.

If you want to customize transformer behavior, consider using io.scalaland.chimney.dsl.TransformerOps#into method.

Type parameters

To

target type

Value parameters

transformer

implicit instance of io.scalaland.chimney.Transformer type class

Attributes

Returns

transformed value of target type To

See also
Since

0.1.0

extension [From](source: From)
transparent inline def transformIntoPartial[To](implicit transformer: PartialTransformer[From, To]): Result[To]

Performs in-place partial transformation of captured source value to target type.

Performs in-place partial transformation of captured source value to target type.

If you want to customize transformer behavior, consider using io.scalaland.chimney.dsl.PartialTransformerOps#intoPartial method.

Type parameters

To

result target type of partial transformation

Value parameters

transformer

implicit instance of io.scalaland.chimney.Transformer type class

Attributes

Returns

partial transformation result value of target type To

See also
Since

0.7.0

transparent inline def transformIntoPartial[To](failFast: Boolean)(implicit transformer: PartialTransformer[From, To]): Result[To]

Performs in-place partial transformation of captured source value to target type.

Performs in-place partial transformation of captured source value to target type.

If you want to customize transformer behavior, consider using io.scalaland.chimney.dsl.PartialTransformerOps#intoPartial method.

Type parameters

To

result target type of partial transformation

Value parameters

failFast

should fail as early as the first set of errors appear

transformer

implicit instance of io.scalaland.chimney.Transformer type class

Attributes

Returns

partial transformation result value of target type To

See also
Since

0.7.0