util

package
v1.36.16 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0 Imports: 7 Imported by: 36

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdjustRateInterval added in v0.9.1

func AdjustRateInterval(namespaceCreationTime time.Time, queryTime time.Time, ratesInterval string) (string, error)

func CryptoRandomBytes added in v1.19.0

func CryptoRandomBytes(n int) ([]byte, error)

CryptoRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

Found at https://gist.github.com/dopey/c69559607800d2f2f90b1b1ed4e550fb

func CryptoRandomString added in v1.19.0

func CryptoRandomString(n int) (string, error)

CryptoRandomString returns a securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

Found at https://gist.github.com/dopey/c69559607800d2f2f90b1b1ed4e550fb

func GetStartTimeForRateInterval added in v0.9.1

func GetStartTimeForRateInterval(baseTime time.Time, rateInterval string) (time.Time, error)

func RandomString added in v1.0.10

func RandomString(n int) string

RandomString generates a random string of length n. Before calling this function, you should call rand.Seed() to initialize the default source.

Found at https://ispycode.com/Blog/golang/2016-10/How-to-generate-a-random-string-of-a-fixed-length

  • Adapted for more characters

func RemoveNilValues added in v1.9.0

func RemoveNilValues(root interface{})

Types

type ClockMock added in v0.9.1

type ClockMock struct {
	Time time.Time
}

func (ClockMock) Now added in v0.9.1

func (clock ClockMock) Now() time.Time

type Errors added in v1.27.0

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

Errors is a struct implementing error interface, allowing to accumulate several errors as a flat list

func (*Errors) Add added in v1.27.0

func (in *Errors) Add(err error)

func (*Errors) AddString added in v1.27.0

func (in *Errors) AddString(str string)

func (*Errors) Count added in v1.27.0

func (in *Errors) Count() int

func (*Errors) Error added in v1.27.0

func (in *Errors) Error() string

func (*Errors) IsEmpty added in v1.27.0

func (in *Errors) IsEmpty() bool

func (*Errors) Merge added in v1.27.0

func (in *Errors) Merge(others *Errors)

func (*Errors) OrNil added in v1.27.0

func (in *Errors) OrNil() *Errors

func (*Errors) Strings added in v1.27.0

func (in *Errors) Strings() []string

type RealClock added in v0.9.1

type RealClock struct{}

func (RealClock) Now added in v0.9.1

func (clock RealClock) Now() time.Time

type TimeProvider added in v0.9.1

type TimeProvider interface {
	Now() time.Time
}
var Clock TimeProvider

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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