Documentation ¶
Overview ¶
Package util provides utility functions. Async related utils.
Package util provides utility functions. Data size related functions.
Package util provides utility functions. Config related utils.
Package util provides utility functions. Slices related utils.
Package util provides utility functions. Testing related.
Package util provides utility functions. Time and duration processing.
Index ¶
- Constants
- func Contains(list []string, s string) bool
- func DurationToString(value time.Duration) string
- func EqualStringSlicesUnordered(x, y []string) bool
- func FormatTime(t time.Time) string
- func GetAPIPath() (string, error)
- func GetBinRootPath() (string, error)
- func GetCloneName(port uint) string
- func GetCloneNameStr(port string) string
- func GetConfigPath(name string) (string, error)
- func GetSwaggerUIPath() (string, error)
- func MillisecondsToString(value float64) string
- func ParseBytes(str string) (uint64, error)
- func ParseCustomTime(str string) (time.Time, error)
- func ParseUnixTime(str string) (time.Time, error)
- func RunInterval(d time.Duration, fn func()) chan struct{}
- func SecondsAgo(ts time.Time) uint
- func Unique(list []string) []string
Constants ¶
const ( // NanosecondsInMillisecond defines a number of nanoseconds in an one millisecond. NanosecondsInMillisecond = 1000000.0 // MillisecondsInSecond defines a number of milliseconds in an one second. MillisecondsInSecond = 1000.0 // MillisecondsInMinute defines a number of milliseconds in an one minute. MillisecondsInMinute = 60000.0 // DataStateAtFormat defines the format of a data state timestamp. DataStateAtFormat = "20060102150405" )
const (
// ClonePrefix defines a Database Lab clone prefix.
ClonePrefix = "dblab_clone_"
)
Variables ¶
This section is empty.
Functions ¶
func DurationToString ¶
DurationToString returns human-readable duration with dimensions.
func FormatTime ¶
FormatTime returns string represeting time in UTC in defined format.
func GetBinRootPath ¶
GetBinRootPath return path to root directory of сurrent binary module.
func GetCloneNameStr ¶ added in v2.4.0
GetCloneNameStr returns a clone name.
func GetConfigPath ¶
GetConfigPath return path to configs directory.
func GetSwaggerUIPath ¶
GetSwaggerUIPath return swagger UI path.
func MillisecondsToString ¶
MillisecondsToString return human-readable duration with dimensions.
func ParseBytes ¶
ParseBytes returns number of bytes from string.
func ParseCustomTime ¶
ParseCustomTime returns time parsed from string in defined format.
func ParseUnixTime ¶
ParseUnixTime returns time parsed from unix timestamp integer.
func RunInterval ¶
func SecondsAgo ¶
SecondsAgo returns a number of seconds elapsed from the current time.
Types ¶
This section is empty.