csv

package
v0.0.0-...-752f67b Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

The csv package contains an encoder that allows many different kinds of data input to be encoded into a csv form.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(input interface{}) (out []byte, err error)

Marshal wraps an Encoder and handles any panics that may occur from invalid input. Any panic returns an error.

Types

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

And Encoder writes tablular data to the output stream

func (*Encoder) Bytes

func (e *Encoder) Bytes() []byte

Bytes renders the internal representation of the table to a byte slice

func (*Encoder) Encode

func (e *Encoder) Encode(input interface{}) error

Encode creates the csv encoding of the input

With structs, the following struct tags are supported using the `render` key:

  • omitempty : ignores the column, if the value is the zero value
  • noprefix : prevents prefixing columns for nested structs with their field name

Fields with the tag `-` are not rendered e.g. `render:"-"`.

func (*Encoder) String

func (e *Encoder) String() string

String renders the internal representation of the table to a string

Jump to

Keyboard shortcuts

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