lib

package
v1.0.0-rc.17 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 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 data {String} CSV text. @param opts {Object?} Decoding options. @return {Array<Object>} 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 data {String} CSV text. @param opts {Object?} Decoding options. @return {Array<Array<Any>>} Decoded row arrays.

func DecodeRowsStream

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

DecodeRowsStream decodes CSV content from string or binary input. It returns an iterator value over row arrays keyed by the original CSV record number after parsing.

@param data {String|Binary} CSV content. @param opts {Object?} Decoding options. @return {Iterator<Array<Any>>} Iterator over decoded row arrays.

func DecodeStream

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

DecodeStream decodes CSV content from string or binary input. It returns an iterator value over objects keyed by the original CSV record number after parsing.

@param data {String|Binary} CSV content. @param opts {Object?} Decoding options. @return {Iterator<Object>} 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 data {Array<Any>} Objects or row arrays to encode. @param opts {Object?} Encoding options. @return {String} CSV text.

func RegisterLib

func RegisterLib(ns runtime.Namespace) error

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