util

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package util provides some utility tools for other components. Such as net-transporting, file-operating, rate-limiter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEmptyStr

func IsEmptyStr(s string) bool

IsEmptyStr returns whether the string s is empty.

func IsNatural

func IsNatural(value string) bool

IsNatural returns whether the value>=0.

func IsNil

func IsNil(value interface{}) bool

IsNil returns whether the value is nil.

func IsNumeric

func IsNumeric(value string) bool

IsNumeric returns whether the value is a numeric. If the bitSize of value below 0 or above 64 an error is returned.

func IsPositive

func IsPositive(value int64) bool

IsPositive returns whether the value is a positive number.

func IsTrue

func IsTrue(value bool) bool

IsTrue returns whether the value is true.

func JSONString

func JSONString(v interface{}) string

JSONString returns json string of the v.

func Max

func Max(x, y int64) int64

Max returns the larger of x or y.

func Min

func Min(x, y int64) int64

Min returns the smaller of x or y.

func NewCounter

func NewCounter(subsystem, name, help string, labels []string) *prometheus.CounterVec

NewCounter will auto-register a Counter metric to prometheus default registry and return it.

func NewGauge

func NewGauge(subsystem, name, help string, labels []string) *prometheus.GaugeVec

NewGauge will auto-register a Gauge metric to prometheus default registry and return it.

func NewHistogram

func NewHistogram(subsystem, name, help string, labels []string, buckets []float64) *prometheus.HistogramVec

NewHistogram will auto-register a Histogram metric to prometheus default registry and return it.

func NewSummary

func NewSummary(subsystem, name, help string, labels []string, objectives map[float64]float64) *prometheus.SummaryVec

NewSummary will auto-register a Summary metric to prometheus default registry and return it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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