serializeCsv

Ion serialization for custom outputt range.

  1. string serializeCsv(V value, char separator, char quote, bool quoteAll, string naValue, string trueValue, string falseValue, int serdeTarget)
  2. void serializeCsv(Appender appender, V value, char separator, char quote, bool quoteAll, string naValue, string trueValue, string falseValue, int serdeTarget)
    void
    serializeCsv
    (
    Appender
    V
    )
    (
    scope ref Appender appender
    ,
    auto scope ref const V value
    ,
    char separator = ','
    ,
    char quote = '"'
    ,
    bool quoteAll = false
    ,
    string naValue = ""
    ,
    string trueValue = "TRUE"
    ,
    string falseValue = "FALSE"
    ,
    int serdeTarget = SerdeTarget.csv
    )
    if (
    isOutputRange!(Appender, const(char)[]) &&
    isOutputRange!(Appender, char)
    )

Examples

import mir.timestamp: Timestamp;
import mir.format: stringBuf;
import mir.test;

auto someMatrix = [
    ["str".CsvAlgebraic, 2.CsvAlgebraic, true.CsvAlgebraic],
    [3.0.CsvAlgebraic, "2022-12-12".Timestamp.CsvAlgebraic, null.CsvAlgebraic]
];

auto buffer = stringBuf;
buffer.serializeCsv(someMatrix);
buffer.data.should == "str,2,TRUE\n3.0,2022-12-12,\n";

Meta