util

package
v0.15.17-hotfix.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2020 License: Apache-2.0 Imports: 5 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DurationToMS

func DurationToMS(duration time.Duration) int64

DurationToMS converts a duration into milliseconds

func HasEmptyString

func HasEmptyString(strs ...string) bool

HasEmptyString returns whether there are any empty strings in given strings

func Memset added in v0.15.0

func Memset(data []float64, value float64)

Memset is a faster way to initialize a float64 array. NB: Inspired from https://github.com/tmthrgd/go-memset, which works directly on the byte interface. The 0 case is optimized due to https://github.com/golang/go/issues/5373 but for non the zero case, we use the copy() optimization. BenchmarkMemsetZeroValues-4 1000000 1344 ns/op BenchmarkLoopZeroValues-4 500000 3217 ns/op BenchmarkMemsetNonZeroValues-4 1000000 1537 ns/op BenchmarkLoopNonZeroValues-4 500000 3236 ns/op

func MemsetInt added in v0.15.0

func MemsetInt(data []int, value int)

MemsetInt is a faster way to initialize an int array.

func ParseDurationString added in v0.15.6

func ParseDurationString(s string) (time.Duration, error)

ParseDurationString parses a string duration allows for float seconds and also time strings such as 7d5h, etc.

func ParseTimeString

func ParseTimeString(s string) (time.Time, error)

ParseTimeString parses a time string into time.Time.

func ParseTimeStringWithDefault added in v0.15.6

func ParseTimeStringWithDefault(
	s string,
	defaultTime time.Time,
) (time.Time, error)

ParseTimeStringWithDefault parses a time string into time.Time.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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