lib

package
v1.0.0-rc.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package lib exposes the Ferret-facing CSV:: functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

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

func DecodeRows(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

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

func DecodeRowsStream(_ context.Context, args ...runtime.Value) (runtime.Value, error)

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

func DecodeStream(_ context.Context, args ...runtime.Value) (runtime.Value, error)

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

func Encode(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

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

func RegisterLib(ns runtime.Namespace)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL