field

package
v0.1.48 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fields

type Fields string

func Check

func Check(str string) (Fields, error)

Check tests whether the provided string is a properly coded fields or not

func NewFields

func NewFields(mp map[string]string) (Fields, error)

NewFields makes new Fields value from the map provided

func NewFieldsFromKVString

func NewFieldsFromKVString(kvs string) (Fields, error)

NewFieldsFromKVString receives a kv-pipe in form `field1=value1, field2=value2...` and turn it to Fields.

func NewFieldsFromSlice added in v0.1.44

func NewFieldsFromSlice(s ...string) (Fields, error)

NewFieldsFromSlice construct new fields from the slice of key-values. It expects even number of parameters where each even element is a key and the next element its value.

func Parse

func Parse(kvs string) Fields

Parse turns kvs to Fields and it doesn't care about error. If kvs is not right string the Fields will be silently empty

func (Fields) AsKVString

func (f Fields) AsKVString() string

AsKVString represents Fields as key-value string

func (Fields) Concat

func (f Fields) Concat(f1 Fields, w *bytes.Writer) Fields

Concat adds fields from f1 to f using writer's w buffer for the result. It just adds all fields from f1 to f, so if f contains some fields from f1, they will added as well Use the method with extra care.

func (Fields) IsEmpty

func (f Fields) IsEmpty() bool

IsEmpty returns whether the field list is empty

func (Fields) MakeCopy

func (f Fields) MakeCopy() Fields

MakeCopy makes an unmutable copy of fields

func (Fields) MergeWithMap

func (f Fields) MergeWithMap(m map[string]string, w *bytes.Writer) Fields

Merge got fields f and merges them with values from map m. Result is written to Writer w and it returns result based on the buffer from w. The result cannot be stored in any collection, but copied only. Use the method with extra care.

func (Fields) Value

func (f Fields) Value(name string) string

Value returns the string value for a field name or empty string if not found

Jump to

Keyboard shortcuts

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