Documentation
¶
Overview ¶
Package lib exposes the Ferret-facing CSV:: functions.
Index ¶
- func Decode(ctx context.Context, args ...runtime.Value) (runtime.Value, error)
- func DecodeRows(ctx context.Context, args ...runtime.Value) (runtime.Value, error)
- func DecodeRowsStream(_ context.Context, args ...runtime.Value) (runtime.Value, error)
- func DecodeStream(_ context.Context, args ...runtime.Value) (runtime.Value, error)
- func Encode(ctx context.Context, args ...runtime.Value) (runtime.Value, error)
- func RegisterLib(ns runtime.Namespace)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode decodes CSV text into an array of objects. When opts.header is true, the first record defines object keys; otherwise opts.columns or generated colN names are used. @param {String} data - CSV string. @param {Options} [opts] - Options for decoding. @return {Any[]} - Array of decoded objects.
func DecodeRows ¶
DecodeRows decodes CSV text into an array of raw row arrays. It keeps header rows as data and applies decoding options to each field. @param {String} data - CSV string. @param {Options} [opts] - Options for decoding. @return {Any[][]} - Array of row arrays.
func DecodeRowsStream ¶
DecodeRowsStream decodes CSV content from string or binary input. It returns a proxy over an iterator of row arrays keyed by the original CSV record number after parsing. @param {String|Binary} data - CSV content. @param {Options} [opts] - Options for decoding. @return {Iterator<Any[]>} - Proxy exposing an iterator over decoded row arrays.
func DecodeStream ¶
DecodeStream decodes CSV content from string or binary input. It returns a proxy over an iterator of objects keyed by the original CSV record number after parsing. @param {String|Binary} data - CSV content. @param {Options} [opts] - Options for decoding. @return {Iterator<Object>} - Proxy exposing an iterator over decoded objects.
func Encode ¶
Encode encodes an array of objects or row arrays into CSV text. Object input can emit a header row depending on opts.header and opts.columns. @param {Any[]} data - Array of objects or arrays. @param {Options} [opts] - Options for encoding. @return {String} - CSV text.
func RegisterLib ¶
RegisterLib registers the CSV::DECODE, CSV::DECODE_ROWS, CSV::DECODE_STREAM, CSV::DECODE_ROWS_STREAM, and CSV::ENCODE functions in the provided namespace.
Types ¶
This section is empty.