recfile

package module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2022 License: GPL-3.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	Name  string
	Value string
}

type Reader

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

func NewReader

func NewReader(r io.Reader) *Reader

Create a Reader for iterating through the records. It uses bufio.Scanner, so can read more than currently parsed records take.

func (*Reader) Next

func (r *Reader) Next() ([]Field, error)

Get next record. Each record is just a collection of fields. io.EOF is returned if there is nothing more to read.

func (*Reader) NextMap

func (r *Reader) NextMap() (map[string]string, error)

Same as Next(), but with unique keys and last value.

func (*Reader) NextMapWithSlice

func (r *Reader) NextMapWithSlice() (map[string][]string, error)

Same as Next(), but with unique keys and slices of values.

type Writer

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

func NewWriter

func NewWriter(w io.StringWriter) *Writer

func (*Writer) RecordStart

func (w *Writer) RecordStart() (written int, err error)

func (*Writer) WriteFieldMultiline

func (w *Writer) WriteFieldMultiline(name string, lines []string) (written int, err error)

func (*Writer) WriteFields

func (w *Writer) WriteFields(fs ...Field) (written int, err error)

Jump to

Keyboard shortcuts

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