zutils

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindJSON

func BindJSON(c zhttp.Context, obj interface{}) error

func CalculateMin

func CalculateMin(subCount int, v interface{}) (res int, err error)

CalculateMin calculate the MinimumShouldMatch value with given expr and sub query count.

func DirSize

func DirSize(path string) (float64, error)

DirSize return the size of the directory (KB)

func FormatDuration

func FormatDuration(d time.Duration) string

func GetAnyFromMap

func GetAnyFromMap(m interface{}, key string) (interface{}, error)

func GetBoolFromMap

func GetBoolFromMap(m interface{}, key string) (bool, error)

func GetFloatFromMap

func GetFloatFromMap(m interface{}, key string) (float64, error)

func GetMapFromMap

func GetMapFromMap(m interface{}, key string) (map[string]interface{}, error)

func GetStringFromMap

func GetStringFromMap(m interface{}, key string) (string, error)

func GetStringSliceFromMap

func GetStringSliceFromMap(m interface{}, key string) ([]string, error)

func IsExist

func IsExist(path string) (bool, error)

func IsNumeric

func IsNumeric(s string) bool

func ParseDuration

func ParseDuration(s string) (time.Duration, error)

func ParseTime

func ParseTime(value interface{}, format, timeZone string) (time.Time, error)

func ParseTimeZone

func ParseTimeZone(name string) (*time.Location, error)

func RenderJSON

func RenderJSON(c zhttp.Context, code int, obj interface{})

func SliceExists

func SliceExists(set []string, find string) bool

SliceExists checks if a string is in a set.

func StringToInt

func StringToInt(s string) int

func ToBool

func ToBool(v interface{}) (bool, error)

func ToFloat64

func ToFloat64(v interface{}) (float64, error)

func ToInt

func ToInt(v interface{}) (int, error)

func ToString

func ToString(v interface{}) (string, error)

func ToUint64

func ToUint64(v interface{}) (uint64, error)

func Unix

func Unix(n int64) time.Time

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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