CsvWriter

zio.blocks.schema.csv.CsvWriter
object CsvWriter

CSV row serialization utility with RFC 4180-compliant field escaping.

Provides methods to serialize individual rows, headers, and complete CSV documents. All field values are escaped according to RFC 4180 rules:

  • Fields containing the delimiter, quote character, or newlines are quoted
  • Quote characters within fields are escaped by doubling them
  • Fields not requiring escaping are written as-is

Attributes

Source
CsvWriter.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
CsvWriter.type

Members list

Value members

Concrete methods

def writeAll(header: IndexedSeq[String], rows: Iterable[IndexedSeq[String]], config: CsvConfig): String

Serializes a complete CSV document with a header row followed by data rows.

Serializes a complete CSV document with a header row followed by data rows.

Value parameters

config

the CSV configuration

header

the column header names

rows

the data rows, each an indexed sequence of field values

Attributes

Returns

a complete CSV document string with header and all data rows

Source
CsvWriter.scala
def writeHeader(names: IndexedSeq[String], config: CsvConfig): String

Serializes a header row. Semantically identical to writeRow but communicates intent that the output represents column names.

Serializes a header row. Semantically identical to writeRow but communicates intent that the output represents column names.

Value parameters

config

the CSV configuration

names

the column header names

Attributes

Returns

a CSV-formatted header row string terminated by config.lineTerminator

Source
CsvWriter.scala
def writeRow(fields: IndexedSeq[String], config: CsvConfig): String

Serializes a single row of fields as a CSV line.

Serializes a single row of fields as a CSV line.

Value parameters

config

the CSV configuration controlling delimiter, quoting, and line termination

fields

the field values to serialize

Attributes

Returns

a CSV-formatted row string terminated by config.lineTerminator

Source
CsvWriter.scala