info

package
v0.0.0-...-be0fcdf Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_INFO_KEY = 64
)

Variables

View Source
var (
	ErrTooLong   = errors.New("info: too long name or value")
	ErrEmptyName = errors.New("info: empty name")
	ErrBadChars  = errors.New("info: bad characters inside name or value")
)

Functions

This section is empty.

Types

type Info

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

Info strings storage object.

func NewInfo

func NewInfo() *Info

Allocate new info strings object.

func NewInfoFromStr

func NewInfoFromStr(str string) (*Info, error)

Allocate new info strings object from string, str is in form of `\key1\value1\key2\value2`.

func (*Info) FromStr

func (info *Info) FromStr(str string) (mErr error)

FromStr converts string like this: `\key1\value1\key2\value2` into map.

func (*Info) Get

func (info *Info) Get(name string) string

Get info string value for key name.

func (*Info) GetOK

func (info *Info) GetOK(name string) (value string, ok bool)

Get info string value for key name with OK idiom.

func (*Info) IsEmpty

func (info *Info) IsEmpty() bool

Return true if info string object contains nothing.

func (*Info) PrintList

func (info *Info) PrintList() string

PrintList print map as human readable list.

func (*Info) Reset

func (info *Info) Reset()

Remove all info strings from the inforstring object.

func (*Info) Set

func (info *Info) Set(name string, a ...interface{}) error

Set info string value for key name.

func (*Info) Setf

func (info *Info) Setf(name string, format string, a ...interface{}) error

Set info string value for key name.

func (*Info) String

func (info *Info) String() string

String converts map to the string like this: `\key1\value1\key2\value2`.

type InfoTs

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

Thread safe version of Info.

func NewInfoTs

func NewInfoTs() *InfoTs

func NewInfoTsFromStr

func NewInfoTsFromStr(str string) (*InfoTs, error)

func (*InfoTs) FromStr

func (its *InfoTs) FromStr(str string) (mErr error)

func (*InfoTs) Get

func (its *InfoTs) Get(name string) string

func (*InfoTs) GetOK

func (its *InfoTs) GetOK(name string) (value string, ok bool)

func (*InfoTs) IsEmpty

func (its *InfoTs) IsEmpty() bool

func (*InfoTs) PrintList

func (its *InfoTs) PrintList() string

func (*InfoTs) Reset

func (its *InfoTs) Reset()

func (*InfoTs) Set

func (its *InfoTs) Set(name string, a ...interface{}) error

func (*InfoTs) Setf

func (its *InfoTs) Setf(name string, format string, a ...interface{}) error

func (*InfoTs) String

func (its *InfoTs) String() string

Jump to

Keyboard shortcuts

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