An implicit defining a default Option reader.
An implicit defining a default Option reader. Uses "" as the empty value.
The desired type for the value
An index into the array
Function to extract a value from a given index
Coerce the value from String to type O
The optional value
Read an optional value using the specified value/rules to determine what is considered None vs what is Some(_).
Read an optional value using the specified value/rules to determine what is considered None vs what is Some(_).
The desired type for the value
Rules for determining if a value should be None
Function to extract a value from a given index
Coerce the value from String to type O
The optional value
Extract the value at a given index, transforming it into a given type.
Extract the value at a given index, transforming it into a given type.
The desired type for the value
An index into the array
A Rule for converting the value from String to O
Failure if the index is out of bounds or the Path was not an IdxPathNode
Rules for parsing/validating/transforming Array[String] as typically returned from CSV parsers.
{{ case class Contact(name: String, email: String, birthday: Option[LocalDate])
val contactReads = From[Delimited] { => ( ( \ 0).read[String] and ( \ 1).read(email) and ( \ 2).read(optionR[LocalDate](equalTo("N/A"))) )(Contact)}
val csv1 = "Ian Hummel,[email protected],1981-07-24".split(",") val csv2 = "Jane Doe,[email protected],N/A".split(",")
contactReads.validate(csv1) // returns Success(Contact("Ian Hummel", "[email protected]", Some(new LocalDate(1981, 7, 24)))) contactReads.validate(csv2) // returns Success(Contact("Jane Doe", "[email protected]", None)) }}