CsvGenerator

com.phasmidsoftware.tableparser.core.render.CsvGenerator
See theCsvGenerator companion trait
object CsvGenerator extends CsvGenerators

Companion object for the CsvGenerator type class providing implicit instances for various types.

The implicit generators defined here are standard implementations used to generate CSV headers for specific data types. These generators are derived from predefined instances in the CsvGenerators object.

Implicit instances:

  • Integer values (Int), using CsvGenerators.CsvGeneratorInt
  • String values (String), using CsvGenerators.CsvGeneratorString
  • Boolean values (Boolean), using CsvGenerators.CsvGeneratorBoolean
  • Double-precision floating-point numbers (Double), using CsvGenerators.CsvGeneratorDouble
  • Arbitrarily large integers (BigInt), using CsvGenerators.CsvGeneratorBigInt
  • Long integer values (Long), using CsvGenerators.CsvGeneratorLong
  • URL values from the java.net package (java.net.URL), using CsvGenerators.CsvGeneratorURL

Attributes

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

Members list

Value members

Concrete methods

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

Method to derive a CsvGenerator (the column names) for a case class T, so that case class T(...) derives CsvGenerator works. This replaces the generator1 ... generator19 methods of 1.x, and has no limit on the number of fields.

Method to derive a CsvGenerator (the column names) for a case class T, so that case class T(...) derives CsvGenerator works. This replaces the generator1 ... generator19 methods of 1.x, and has no limit on the number of fields.

The column name of each field is exactly the name that CellParser.derived looks for when it reads that field: ColumnHelper[T].lookup of the field's name, given the column name of the enclosing field (if any). So a table which is written can be read back. For example, if ColumnHelper[Principal] has the prefix "$x_$c", the name field of a Principal field called director is in the column director_name. Without a ColumnHelper of its own, a field's column name is its name. A field whose type is itself a case class, and which has no CsvGenerator 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 CsvProductGenerator[T].

Inherited methods

def optionGenerator[T](using ca: CsvAttributes): CsvGenerator[Option[T]]

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

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

Type parameters

T

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

Attributes

Returns

a CsvGenerator[ Option[T] ].

Inherited from:
CsvGenerators
def optionProductGenerator[T](using g: CsvGenerator[T]): CsvGenerator[Option[T]]

Method to return a CsvGenerator[Option[T]] whose columns are those of T. Use this for an optional field whose type has several columns (e.g. a case class), together with CsvRenderers.optionProductRenderer. (optionGenerator gives an Option just one column.)

Method to return a CsvGenerator[Option[T]] whose columns are those of T. Use this for an optional field whose type has several columns (e.g. a case class), together with CsvRenderers.optionProductRenderer. (optionGenerator gives an Option just one column.)

Type parameters

T

the underlying type.

Value parameters

g

the CsvGenerator[T].

Attributes

Returns

a CsvGenerator[Option[T]].

Inherited from:
CsvGenerators
def sequenceGenerator[T](using ca: CsvAttributes): CsvGenerator[Seq[T]]

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

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

Type parameters

T

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

Attributes

Returns

a CsvGenerator[ Seq[T] ]

Inherited from:
CsvGenerators
def skipGenerator[T](using ca: CsvAttributes): CsvGenerator[T]

Method to return a CsvGenerator[T] which does not output a column header for at all.

Method to return a CsvGenerator[T] which does not output a column header for at all.

Type parameters

T

the type of the column objects.

Attributes

Returns

a CsvGenerator[T].

Inherited from:
CsvGenerators

Givens

Inherited givens

given optionBigIntGenerator: CsvGenerator[Option[BigInt]]

Attributes

Inherited from:
CsvGenerators
given optionBooleanGenerator: CsvGenerator[Option[Boolean]]

Attributes

Inherited from:
CsvGenerators
given optionByteGenerator: CsvGenerator[Option[Byte]]

Attributes

Inherited from:
CsvGenerators
given optionDoubleGenerator: CsvGenerator[Option[Double]]

Attributes

Inherited from:
CsvGenerators
given optionFloatGenerator: CsvGenerator[Option[Float]]

Attributes

Inherited from:
CsvGenerators
given optionInstantGenerator: CsvGenerator[Option[Instant]]

Attributes

Inherited from:
CsvGenerators
given optionIntGenerator: CsvGenerator[Option[Int]]

Attributes

Inherited from:
CsvGenerators
given optionLocalDateGenerator: CsvGenerator[Option[LocalDate]]

Attributes

Inherited from:
CsvGenerators
given optionLongGenerator: CsvGenerator[Option[Long]]

Attributes

Inherited from:
CsvGenerators
given optionShortGenerator: CsvGenerator[Option[Short]]

Attributes

Inherited from:
CsvGenerators
given optionStringGenerator: CsvGenerator[Option[String]]

Attributes

Inherited from:
CsvGenerators