utils

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: Apache-2.0 Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LineToSlice added in v0.8.1

func LineToSlice(s string) []string

LineToSlice converts POSIX line breaks to a string slice

func MergeMap

func MergeMap(data map[string]string, resultTo interface{}) error

MergeMap copy keys from a `data` map to a `resultTo` tagged object

func PatternLineToSlice added in v0.16.0

func PatternLineToSlice(patterns map[string]string, s string) []string

PatternLineToSlice converts POSIX line breaks to a string slice, and replaces patterns found in the source string to the resulting slice.

func SendToSocket

func SendToSocket(socket string, command string) error

SendToSocket send strings to a unix socket specified

func SizeSuffixToInt64

func SizeSuffixToInt64(size string) (int64, error)

SizeSuffixToInt64 converts a size in string format with suffix into int64

func Split added in v0.8.1

func Split(s, sep string) []string

Split returns a slice of substrings from s, separated by sep. If s is empty, Split returns an empty slice. Split will also TrimSpace() all resulting substrings.

func SplitHeaderNameValue added in v0.15.0

func SplitHeaderNameValue(header string) (name, value string, err error)

SplitHeaderNameValue splits a header line declaration into header name and value. Note that name and value might be empty for an empty input.

Types

type Tick added in v0.8.1

type Tick struct {
	Event    string
	When     time.Time
	Duration time.Duration
}

Tick ...

type Timer added in v0.8.1

type Timer struct {
	Start time.Time
	Ticks []*Tick
	// contains filtered or unexported fields
}

Timer ...

func NewTimer added in v0.8.1

func NewTimer(observer func(task string, duration time.Duration)) *Timer

NewTimer ...

func (*Timer) AsString added in v0.8.1

func (t *Timer) AsString(totalLabel string) string

AsString ...

func (*Timer) AsValues added in v0.15.0

func (t *Timer) AsValues(totalLabel string) []interface{}

AsValues ...

func (*Timer) Tick added in v0.8.1

func (t *Timer) Tick(eventLabel string)

Tick ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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