case class RowF[H[+a] <: Option[a], Header](values: NonEmptyList[String], headers: H[NonEmptyList[Header]], line: Option[Long] = None) extends Product with Serializable

A CSV row with or without headers. The presence of headers is encoded via the first type param which is a subtype of scala.Option. By preserving this information in types, it's possible to define Row and CsvRow aliases as if they were plain case classes while keeping the code DRY.

Operations on columns can always be performed using 0-based indices and additionally using a specified header value if headers are present (and this fact statically known).

Note: the following invariant holds when using this class: values and headers have the same size if headers are present.

Source
RowF.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. RowF
  2. Serializable
  3. Product
  4. Equals
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new RowF(values: NonEmptyList[String], headers: H[NonEmptyList[Header]], line: Option[Long] = None)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def apply(header: Header)(implicit hasHeaders: HasHeaders[H, Header]): Option[String]

    Returns the content of the cell at header if it exists.

    Returns the content of the cell at header if it exists. Returns None if header does not exist for the row. An empty cell value results in Some("").

  5. def as[T](header: Header)(implicit hasHeaders: HasHeaders[H, Header], decoder: CellDecoder[T]): DecoderResult[T]

    Returns the decoded content of the cell at header.

    Returns the decoded content of the cell at header. Fails if the field doesn't exist or cannot be decoded to the expected type.

  6. def asAt[T](idx: Int)(implicit decoder: CellDecoder[T]): DecoderResult[T]

    Returns the decoded content of the cell at idx.

    Returns the decoded content of the cell at idx. Fails if the index doesn't exist or cannot be decoded to the expected type.

  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. def asOptional[T](header: Header, missing: (Header) => DecoderResult[Option[T]] = (header: Header) => Left(new DecoderError(s"unknown field $header")), isEmpty: (String) => Boolean = _.isEmpty)(implicit hasHeaders: HasHeaders[H, Header], decoder: CellDecoder[T]): DecoderResult[Option[T]]

    Returns the decoded content of the cell at header wrapped in Some if the cell is non-empty, None otherwise.

    Returns the decoded content of the cell at header wrapped in Some if the cell is non-empty, None otherwise. The meaning of _empty_ can be tuned by setting providing a custom isEmpty predicate (by default, matches the empty string). In case the field does not exist, the missing parameter defines the behavior (by default, it faile) Fails if the index cannot be decoded to the expected type.

  9. def asOptionalAt[T](idx: Int, missing: (Int) => DecoderResult[Option[T]] = (idx: Int) => Left(new DecoderError(s"unknown index $idx")), isEmpty: (String) => Boolean = _.isEmpty)(implicit decoder: CellDecoder[T]): DecoderResult[Option[T]]

    Returns the decoded content of the cell at idx wrapped in Some if the cell is non-empty, None otherwise.

    Returns the decoded content of the cell at idx wrapped in Some if the cell is non-empty, None otherwise. The meaning of _empty_ can be tuned by setting providing a custom isEmpty predicate (by default, matches the empty string). In case the index does not exist, the missing parameter defines the behavior (by default, it faile) Fails if the index cannot be decoded to the expected type.

  10. def at(idx: Int): Option[String]

    Returns the content of the cell at idx if it exists.

    Returns the content of the cell at idx if it exists. Returns None if idx is out of row bounds. An empty cell value results in Some("").

  11. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  12. def delete(header: Header)(implicit hasHeaders: HasHeaders[H, Header]): Option[CsvRow[Header]]

    Returns the row without the cell at the given header.

    Returns the row without the cell at the given header. If the resulting row is empty, returns None.

    **Note:** Only the first occurrence of the values with the given header will be deleted. It shouldn't be a problem in the general case as headers should not be duplicated.

  13. def deleteAt(idx: Int): Option[RowF[H, Header]]

    Returns the row without the cell at the given idx.

    Returns the row without the cell at the given idx. If the resulting row is empty, returns None.

  14. def dropHeaders: Row

    Drop all headers (if any).

    Drop all headers (if any).

    returns

    a row without headers, but same values

  15. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  17. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  18. val headers: H[NonEmptyList[Header]]
  19. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  20. val line: Option[Long]
  21. def modify(header: Header)(f: (String) => String)(implicit hasHeaders: HasHeaders[H, Header]): CsvRow[Header]

    Modifies the cell content at the given header using the function f.

    Modifies the cell content at the given header using the function f.

    **Note:** Only the first occurrence of the values with the given header will be modified. It shouldn't be a problem in the general case as headers should not be duplicated.

  22. def modifyAt(idx: Int)(f: (String) => String): RowF[H, Header]

    Modifies the cell content at the given idx using the function f.

  23. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  24. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  25. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  26. def productElementNames: Iterator[String]
    Definition Classes
    Product
  27. def set(header: Header, value: String)(implicit hasHeaders: HasHeaders[H, Header]): CsvRow[Header]

    Returns the row with the cell at header modified to value.

    Returns the row with the cell at header modified to value. If the header wasn't present in the row, it is added to the end of the fields.

    **Note:** Only the first occurrence of the values with the given header will be modified. It shouldn't be a problem in the general case as headers should not be duplicated.

  28. def size: Int

    Number of cells in the row.

  29. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  30. def toMap(implicit hasHeaders: HasHeaders[H, Header]): Map[Header, String]

    Returns a representation of this row as Map from headers to corresponding cell values.

  31. def toNonEmptyMap(implicit hasHeaders: HasHeaders[H, Header], order: Order[Header]): NonEmptyMap[Header, String]

    Returns a representation of this row as NonEmptyMap from headers to corresponding cell values.

  32. def updated(header: Header, value: String)(implicit hasHeaders: HasHeaders[H, Header]): CsvRow[Header]

    Returns the row with the cell at header modified to value.

    Returns the row with the cell at header modified to value.

    **Note:** Only the first occurrence of the values with the given header will be modified. It shouldn't be a problem in the general case as headers should not be duplicated.

  33. def updatedAt(idx: Int, value: String): RowF[H, Header]

    Returns the row with the cell at idx modified to value.

  34. val values: NonEmptyList[String]
  35. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  36. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  37. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  38. def withLine(line: Option[Long]): RowF[H, Header]

    Set the line number for this row.

Deprecated Value Members

  1. def asNonEmpty[T](header: Header)(implicit hasHeaders: HasHeaders[H, Header], decoder: CellDecoder[T]): DecoderResult[Option[T]]

    Returns the decoded content of the cell at header wrapped in Some if the cell is non-empty, None otherwise.

    Returns the decoded content of the cell at header wrapped in Some if the cell is non-empty, None otherwise. Fails if the field doesn't exist or cannot be decoded to the expected type.

    Annotations
    @deprecated
    Deprecated

    (Since version fs2-data 1.7.0) Use RowF.asOptional instead, as it gives more flexibility and has the same default behavior.

  2. def asNonEmptyAt[T](idx: Int)(implicit decoder: CellDecoder[T]): DecoderResult[Option[T]]

    Returns the decoded content of the cell at idx wrapped in Some if the cell is non-empty, None otherwise.

    Returns the decoded content of the cell at idx wrapped in Some if the cell is non-empty, None otherwise. Fails if the index doesn't exist or cannot be decoded to the expected type.

    Annotations
    @deprecated
    Deprecated

    (Since version fs2-data 1.7.0) Use RowF.asOptionalAt instead, as it gives more flexibility and has the same default behavior.

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped