util

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

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

View Source
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"
)
View Source
const (
	// ClonePrefix defines a Database Lab clone prefix.
	ClonePrefix = "dblab_clone_"
)

Variables

This section is empty.

Functions

func Contains

func Contains(list []string, s string) bool

func DurationToString

func DurationToString(value time.Duration) string

DurationToString returns human-readable duration with dimensions.

func EqualStringSlicesUnordered

func EqualStringSlicesUnordered(x, y []string) bool

func FormatTime

func FormatTime(t time.Time) string

FormatTime returns string represeting time in UTC in defined format.

func GetAPIPath

func GetAPIPath() (string, error)

GetAPIPath return swagger UI path.

func GetBinRootPath

func GetBinRootPath() (string, error)

GetBinRootPath return path to root directory of сurrent binary module.

func GetCloneName

func GetCloneName(port uint) string

GetCloneName returns a clone name.

func GetCloneNameStr added in v2.4.0

func GetCloneNameStr(port string) string

GetCloneNameStr returns a clone name.

func GetConfigPath

func GetConfigPath(name string) (string, error)

GetConfigPath return path to configs directory.

func GetSwaggerUIPath

func GetSwaggerUIPath() (string, error)

GetSwaggerUIPath return swagger UI path.

func MillisecondsToString

func MillisecondsToString(value float64) string

MillisecondsToString return human-readable duration with dimensions.

func ParseBytes

func ParseBytes(str string) (uint64, error)

ParseBytes returns number of bytes from string.

func ParseCustomTime

func ParseCustomTime(str string) (time.Time, error)

ParseCustomTime returns time parsed from string in defined format.

func ParseUnixTime

func ParseUnixTime(str string) (time.Time, error)

ParseUnixTime returns time parsed from unix timestamp integer.

func RunInterval

func RunInterval(d time.Duration, fn func()) chan struct{}

func SecondsAgo

func SecondsAgo(ts time.Time) uint

SecondsAgo returns a number of seconds elapsed from the current time.

func Unique

func Unique(list []string) []string

Types

This section is empty.

Directories

Path Synopsis
Package networks describes custom network elements.
Package networks describes custom network elements.
Package pglog provides helpers for a Postgres logs processing.
Package pglog provides helpers for a Postgres logs processing.

Jump to

Keyboard shortcuts

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