utils

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FloatType = CounterType("float64")
	UintType  = CounterType("uint64")
)

Variables

This section is empty.

Functions

func ConcatFormat

func ConcatFormat(stringList []string) string

func FormatUUID

func FormatUUID(uuid *events.UUID) string

func GetHostIPInfo

func GetHostIPInfo(host string) (string, string, error)

GetHostIPInfo returns hostname and corresponding IP address If empty host is passed in, the current hostname and IP of the host will be returned. If the IP of the hostname can't be resolved, an empty IP and an error will be returned

func NanoSecondsToSeconds

func NanoSecondsToSeconds(nanoseconds int64) string

func ToJson

func ToJson(msg string) interface{}

ToJSON tries to detect the JSON pattern for msg first, if msg contains JSON pattern either a map or an array (for efficiency), it will try to convert msg to a JSON object. If the convertion success, a JSON object will be returned. Otherwise the original msg will be returned If the msg param doesn't contain the JSON pattern, the msg will be returned directly

Types

type Counter added in v1.3.0

type Counter interface {
	Add(interface{})
	Clone() Counter
	Value() interface{}
}

type CounterType added in v1.3.0

type CounterType string

type IntCounter added in v1.3.0

type IntCounter uint64

func (*IntCounter) Add added in v1.3.0

func (ic *IntCounter) Add(num interface{})

func (*IntCounter) Clone added in v1.3.0

func (ic *IntCounter) Clone() Counter

func (*IntCounter) Value added in v1.3.0

func (ic *IntCounter) Value() interface{}

type NopCounter added in v1.3.0

type NopCounter struct{}

func (*NopCounter) Add added in v1.3.0

func (nc *NopCounter) Add(num interface{})

func (*NopCounter) Clone added in v1.3.0

func (nc *NopCounter) Clone() Counter

func (*NopCounter) Value added in v1.3.0

func (nc *NopCounter) Value() interface{}

type Set added in v1.3.0

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

func NewSet added in v1.3.0

func NewSet() *Set

func (*Set) Add added in v1.3.0

func (s *Set) Add(value string)

func (*Set) Contains added in v1.3.0

func (s *Set) Contains(value string) bool

func (*Set) Len added in v1.3.0

func (s *Set) Len() int

func (*Set) Remove added in v1.3.0

func (s *Set) Remove(value string)

Jump to

Keyboard shortcuts

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