CsvRenderer

com.phasmidsoftware.tableparser.core.render.CsvRenderer
See theCsvRenderer companion trait
object CsvRenderer extends CsvRenderers

An object that provides type class support for rendering data as CSV (Comma-Separated Values).

The CsvRenderer object is designed to define implicit instances of CsvRenderer for specific types, allowing those types to be rendered to a CSV format string. It relies on the Renderer type class, which generalizes rendering objects of type T into objects of type O (in this case, strings).

This object can include predefined implicit renderers (e.g., Row renderer) that leverage attributes (Map[String, String]) to modify the output or handle special behaviors for CSV attributes.

Attributes

Companion
trait
Graph
Supertypes
trait CsvRenderers
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

object CsvRendererRow extends CsvRenderer[Row]

Implicit object that provides a CSV rendering implementation for the Row class.

Implicit object that provides a CSV rendering implementation for the Row class.

This object extends the CsvRenderer type class for Row, enabling rows to be rendered as CSV strings. The default behavior concatenates the row elements (ws) into a single string, separated by the delimiter defined in the implicit CsvAttributes.

Attributes

See also

CsvRenderer

Row

Supertypes
trait CsvRenderer[Row]
trait Renderer[Row, String]
class Object
trait Matchable
class Any
Self type

Value members

Concrete methods

inline def derived[T](using m: ProductOf[T], ca: CsvAttributes): CsvRenderer[T]

Method to derive a CsvRenderer for a case class T, so that case class T(...) derives CsvRenderer works. This replaces the renderer1 ... renderer19 methods of 1.x, and has no limit on the number of fields. A field whose type is itself a case class, and which has no CsvRenderer of its own, is derived in turn.

Method to derive a CsvRenderer for a case class T, so that case class T(...) derives CsvRenderer works. This replaces the renderer1 ... renderer19 methods of 1.x, and has no limit on the number of fields. A field whose type is itself a case class, and which has no CsvRenderer of its own, is derived in turn.

NOTE: for a case class defined inside a method, see the NOTE on CellParser.derived.

Type parameters

T

a case class.

Value parameters

ca

the CsvAttributes.

m

the Mirror of T.

Attributes

Returns

a CsvRenderer[T].

Inherited methods

def optionProductRenderer[T](using r: CsvRenderer[T], g: CsvGenerator[T], ca: CsvAttributes): CsvRenderer[Option[T]]

Method to return a CsvRenderer[Option[T]] for a T which has several columns (e.g. a case class). None is rendered as the right number of empty cells, so that the columns which follow stay aligned. Use this together with CsvGenerators.optionProductGenerator. (optionRenderer renders None as just one cell.)

Method to return a CsvRenderer[Option[T]] for a T which has several columns (e.g. a case class). None is rendered as the right number of empty cells, so that the columns which follow stay aligned. Use this together with CsvGenerators.optionProductGenerator. (optionRenderer renders None as just one cell.)

Type parameters

T

the underlying type.

Value parameters

ca

the CsvAttributes.

g

the CsvGenerator[T], which determines how many columns a T has.

r

the CsvRenderer[T].

Attributes

Returns

a CsvRenderer[Option[T]].

Inherited from:
CsvRenderers
def optionRenderer[T](defaultString: String = ...)(using evidence$1: CsvRenderer[T], ca: CsvAttributes): CsvRenderer[Option[T]]

Method to return a CsvRenderer[ Option[T] ].

Method to return a CsvRenderer[ Option[T] ].

Type parameters

T

the underlying type of the first parameter of the input to the render method.

Value parameters

ca

the (implicit) CsvAttributes.

Attributes

Returns

a CsvRenderer[ Option[T] ].

Inherited from:
CsvRenderers

Method to return a CsvRenderer[RawRow].

Method to return a CsvRenderer[RawRow].

Value parameters

ca

the (implicit) CsvAttributes.

Attributes

Returns

a CsvRenderer[RawRow].

Inherited from:
CsvRenderers
def sequenceRenderer[T](using evidence$1: CsvRenderer[T], ca: CsvAttributes): CsvRenderer[Seq[T]]

Method to return a CsvRenderer[ Seq[T] ].

Method to return a CsvRenderer[ Seq[T] ].

Type parameters

T

the underlying type of the first parameter of the input to the render method.

Value parameters

ca

the (implicit) CsvAttributes.

Attributes

Returns

a CsvRenderer[ Seq[T] ]

Inherited from:
CsvRenderers
def skipRenderer[T](alignment: Int = ...)(using ca: CsvAttributes): CsvRenderer[T]

Method to return a CsvRenderer[T] which does not output a T at all, only a number of delimiters according to the value of alignment.

Method to return a CsvRenderer[T] which does not output a T at all, only a number of delimiters according to the value of alignment.

Type parameters

T

the type of the parameter to the render method.

Value parameters

alignment

(defaults to 1): one more than the number of delimiters to output. If you are skipping a Product (such as a case class instance), then you should carefully count up how many (nested) elements to skip. So, for example, if you are skipping a Product with three members, you would set alignment = 3, even though you only want to output 2 delimiters.

ca

the (implicit) CsvAttributes.

Attributes

Returns

a CsvRenderer[T].

Inherited from:
CsvRenderers

Givens

Givens

Implicit object that provides a CSV rendering implementation for the Row class.

Implicit object that provides a CSV rendering implementation for the Row class.

This object extends the CsvRenderer type class for Row, enabling rows to be rendered as CSV strings. The default behavior concatenates the row elements (ws) into a single string, separated by the delimiter defined in the implicit CsvAttributes.

Attributes

See also

CsvRenderer

Row

given instantRenderer: CsvRenderer[Instant]
given localDateRenderer: CsvRenderer[LocalDate]
given rendererBoolean: CsvRenderer[Boolean]
given rendererByte: CsvRenderer[Byte]
given rendererDouble: CsvRenderer[Double]
given rendererFloat: CsvRenderer[Float]
given rendererInt: CsvRenderer[Int]
given rendererLong: CsvRenderer[Long]
given rendererOptionByte: CsvRenderer[Option[Byte]]
given rendererOptionDouble: CsvRenderer[Option[Double]]
given rendererOptionFloat: CsvRenderer[Option[Float]]
given rendererOptionInstant: CsvRenderer[Option[Instant]]
given rendererOptionInt: CsvRenderer[Option[Int]]
given rendererOptionLong: CsvRenderer[Option[Long]]
given rendererOptionShort: CsvRenderer[Option[Short]]
given rendererOptionString: CsvRenderer[Option[String]]
given rendererShort: CsvRenderer[Short]
given rendererURL: CsvRenderer[URL]
given stringRenderer: CsvRenderer[String]