ltsv

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package ltsv provides LTSV utility functioons.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(w io.StringWriter, props []Property) error

Types

type Property

type Property struct {
	Label string
	Value string
}

Property is a pair of label and value.

type Reader

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

Reader reads LTSV values.

func NewReader

func NewReader(r io.Reader) *Reader

NewReader creates a new LTSV reader.

func (*Reader) Read

func (r *Reader) Read() (*Set, error)

Read read a LTSV value.

type Set

type Set struct {
	Properties []Property
	Index      map[string][]int
}

Set is a set of LTSV values in a line.

func (*Set) Empty

func (s *Set) Empty() bool

Empty checks set is empty or not.

func (*Set) Get

func (s *Set) Get(label string) []string

Get gets values for the label.

func (*Set) GetFirst

func (s *Set) GetFirst(label string) string

GetFirst gets a first value for the label.

func (*Set) Put

func (s *Set) Put(label, value string)

Put puts a property to the set.

type Writer

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

Writer is LTSV writer.

func NewWriter

func NewWriter(w io.Writer, labels ...string) *Writer

NewWriter creates new LTSV writer.

func (*Writer) Write

func (w *Writer) Write(values ...string) error

Write writes a LTSV line.

Jump to

Keyboard shortcuts

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