csv

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2023 License: MIT Imports: 2 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config qfio.CSVConfig

Config holds configuration for reading CSV files into QFrames. It should be considered a private implementation detail and should never be referenced or used directly outside of the QFrame code. To manipulate it use the functions returning ConfigFunc below.

func NewConfig

func NewConfig(ff []ConfigFunc) Config

NewConfig creates a new Config object. This function should never be called from outside QFrame.

type ConfigFunc

type ConfigFunc func(*Config)

ConfigFunc is a function that operates on a Config object.

func Delimiter

func Delimiter(delimiter byte) ConfigFunc

Delimiter configures the delimiter/separator between columns. Only byte representable delimiters are supported. Default is ','.

delimiter - The delimiter to use.

func EmptyNull

func EmptyNull(emptyNull bool) ConfigFunc

EmptyNull configures if empty strings should be considered as empty strings (default) or null.

emptyNull - If set to true empty string will be translated to null.

func EnumValues

func EnumValues(values map[string][]string) ConfigFunc

EnumValues is used to list the possible values and internal order of these values for an enum column.

values - map column name -> list of valid values.

Enum columns that do not specify the values are automatically assigned values based on the content of the column. The ordering between these values is undefined. It hence doesn't make much sense to sort a QFrame on an enum column unless the ordering has been specified.

Note that the column must be listed as having an enum type (using Types above) for this option to take effect.

func Headers added in v0.3.2

func Headers(headers []string) ConfigFunc

Headers can be used to specify the header names for a CSV file without header.

header - Slice with column names.

func IgnoreEmptyLines

func IgnoreEmptyLines(ignoreEmptyLines bool) ConfigFunc

IgnoreEmptyLines configures if a line without any characters should be ignored or interpreted as a zero length string.

IgnoreEmptyLines - If set to true empty lines will not produce any data.

func MissingColumnNameAlias added in v0.4.0

func MissingColumnNameAlias(MissingColumnNameAlias string) ConfigFunc

MissingColumnNameAlias sets the name to be used for empty columns name with given string

func RenameDuplicateColumns added in v0.4.0

func RenameDuplicateColumns(RenameDuplicateColumns bool) ConfigFunc

RenameDuplicateColumns configures if duplicate column names should have the column index appended to the column name to resolve the conflict.

func RowCountHint

func RowCountHint(rowCount int) ConfigFunc

RowCountHint can be used to provide an indication of the number of rows in the CSV. In some cases this will help allocating buffers more efficiently and improve import times.

rowCount - The number of rows.

func Types

func Types(typs map[string]string) ConfigFunc

Types is used set types for certain columns. If types are not given a best effort attempt will be done to auto detected the type.

typs - map column name -> type name. For a list of type names see package qframe/types.

type ToConfig added in v0.4.0

type ToConfig qfio.ToCsvConfig

ToConfig holds configuration for writing CSV files

func NewToConfig added in v0.4.0

func NewToConfig(ff []ToConfigFunc) ToConfig

NewConfig creates a new ToConfig object. This function should never be called from outside QFrame.

type ToConfigFunc added in v0.4.0

type ToConfigFunc func(*ToConfig)

ToConfigFunc is a function that operates on a ToConfig object.

func Header(header bool) ToConfigFunc

Header indicates whether or not the CSV file should be written with a header. Default is true.

Jump to

Keyboard shortcuts

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