util

package
v1.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	TierBegin = 0
	Hot       = 1
	Warm      = 2
	Cold      = 3
	TierEnd   = 4
)

Variables

This section is empty.

Functions

func CeilToPower2 added in v0.2.0

func CeilToPower2(num uint32) uint32

func HttpError added in v1.0.0

func HttpError(w http.ResponseWriter, errmsg string, code int)

httpError writes an error to the client in a standard format.

func Include added in v1.0.0

func Include(slice []uint64, s uint64) bool

Include returns true or false if given array is in slice.

func IndexOf added in v1.0.0

func IndexOf(slice []uint64, s uint64) int

IndexOf returns index position in slice from given array If value is -1, the string does not found.

func IntLimit added in v1.0.0

func IntLimit(min, max int, v int) int

func IsObjectNil

func IsObjectNil(obj interface{}) bool

func MustClose

func MustClose(obj io.Closer)

func SetLogger

func SetLogger(lg *zap.Logger)

func TimeCost added in v1.0.0

func TimeCost(option string) func()

Types

type Corrector

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

func NewCorrector

func NewCorrector(intMin int64, floatMin float64) *Corrector

func (*Corrector) Float64

func (c *Corrector) Float64(v *float64, def float64)

func (*Corrector) Int

func (c *Corrector) Int(v *int, def int)

func (*Corrector) String

func (c *Corrector) String(v *string, def string)

func (*Corrector) TomlDuration

func (c *Corrector) TomlDuration(v *toml.Duration, def toml.Duration)

func (*Corrector) TomlSize

func (c *Corrector) TomlSize(v *toml.Size, def toml.Size)

func (*Corrector) Uint64

func (c *Corrector) Uint64(v *uint64, def uint64)

Jump to

Keyboard shortcuts

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