writer

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package iterator provides an easy API to create an iterator to read objects from a file. Depends on the following packages in go-simple-serializer.

  • github.com/spatialcurrent/go-simple-serializer/pkg/jsonl
  • github.com/spatialcurrent/go-simple-serializer/pkg/sv
  • github.com/spatialcurrent/go-simple-serializer/pkg/tags

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingKeyValueSeparator = errors.New("missing key-value separator")
	ErrMissingLineSeparator     = errors.New("missing line separator")
)

Functions

func NewWriter

func NewWriter(input *NewWriterInput) (pipe.Writer, error)

NewWriter returns a new pipe.Writer for writing formatted objects to an underlying writer.

Types

type ErrInvalidFormat

type ErrInvalidFormat struct {
	Format string // the name of the invalid format
}

ErrInvalidFormat is used when an invalid format is provided.

func (ErrInvalidFormat) Error

func (e ErrInvalidFormat) Error() string

Error returns the error as a string.

type NewWriterInput

type NewWriterInput struct {
	Writer            io.Writer
	Format            string
	FormatSpecifier   string
	Header            []interface{}
	ExpandHeader      bool // in context, only used by tags as ExpandKeys
	KeySerializer     stringify.Stringer
	ValueSerializer   stringify.Stringer
	KeyValueSeparator string
	LineSeparator     string
	Fit               bool
	Pretty            bool
	Sorted            bool
	Reversed          bool
}

Parameters for NewWriter function.

Jump to

Keyboard shortcuts

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