Record and LogLine
Baker processes objects called records.
A Record
, in Baker, is an interface that provides an abstraction over a record of
structured data, where fields are indexed and accessed via integers.
At the moment, Baker provides a single implementation of the Record interface,
called LogLine
.
If LogLine
doesn’t fit your needs, you can implement the
Record
interface or
modify LogLine
. See the custom Record how-to
for more details about implementing the Record
interface from scratch.
LogLine
A LogLine
is an implementation
of the Record
interface
which is highly optimized for fast parsing and serializing of CSV records.
It supports any single-byte field separator and doesn’t handle quotes (neither single nor double).
The maximum number of fields is hard-coded by the LogLineNumFields
constant which is 3000.
100 extra fields can be stored at runtime in a LogLine
(also hardcoded with NumFieldsBaker
),
these extra fields are a fast way to exchange data between filters and/or outputs but they are
neither handled during Parsing (i.e LogLine.Parse
) nor serialization (LogLine.ToText
).
Custom LogLine
If the hardcoded values for
LogLineNumFields
and NumFieldsBaker
do not suit your needs, you can copy logline.go
in your project and modify the constants declared at the top of the file.
Your specialized LogLine
will still implement baker.Record
and thus can be used in lieu
of baker.LogLine
.
The CreateRecord
function set into
baker.Components
must return an
instance of your custom LogLine
instead of the default one.