util

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 6 Imported by: 5 modules, 6 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
Package json contains logic for writing JSON.
Package json contains logic for writing JSON.

Jump to

Keyboard shortcuts

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