util

package
v0.0.0-...-aa29b24 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseDuration

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

ParseDuration is a copy of time.ParseDuration that understands days, weeks and months.

nolint

func RandomID

func RandomID() string

RandomID generates a random unique ID. It will return an identifier consisting of 32 ascii-friendly bytes (16 random bytes, hex-encoded).

func RandomSeed

func RandomSeed() (int64, []byte)

Generate a random int64, and return it along with its byte representation (encoding/binary, little-endian).

Types

type MultiError

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

MultiError is just a container of other errors, wrapped into a single error.

func (*MultiError) Add

func (m *MultiError) Add(err error)

Add an error to the container.

func (*MultiError) Error

func (m *MultiError) Error() string

Error returns the error string. Implements the 'error' interface.

func (*MultiError) Errors

func (m *MultiError) Errors() []error

Errors returns a list of all errors in the container.

func (*MultiError) IsNil

func (m *MultiError) IsNil() bool

IsNil returns true if the container is empty.

func (*MultiError) OrNil

func (m *MultiError) OrNil() error

OrNil returns either this same error, if not empty, or nil.

Jump to

Keyboard shortcuts

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