util

package
v3.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2022 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

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 DurationToString

func DurationToString(value time.Duration) string

DurationToString returns human-readable duration with dimensions.

func FormatTime

func FormatTime(t time.Time) string

FormatTime returns string representing 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 the current binary module.

func GetCloneName

func GetCloneName(port uint) string

GetCloneName returns a clone name.

func GetCloneNameStr

func GetCloneNameStr(port string) string

GetCloneNameStr returns a clone name.

func GetConfigPath

func GetConfigPath(name string) (string, error)

GetConfigPath return path to configuration file.

func GetDataFreshness

func GetDataFreshness(dataStateAt string) *float64

GetDataFreshness returns the time elapsed since the specified date.

func GetMetaPath

func GetMetaPath(name string) (string, error)

GetMetaPath return path to metadata directory.

func GetStandardConfigPath

func GetStandardConfigPath(name string) (string, error)

GetStandardConfigPath return path to file in the directory of standard configs.

func GetSwaggerUIPath

func GetSwaggerUIPath() (string, error)

GetSwaggerUIPath return swagger UI path.

func HashID

func HashID(id string) string

HashID returns a hash of provided string.

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 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

Unique returns unique values of slice.

Types

This section is empty.

Directories

Path Synopsis
Package engine contains tools.
Package engine contains tools.
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