zutils

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 GinBindJSON

func GinBindJSON(c *gin.Context, obj interface{}) error

func GinRenderJSON

func GinRenderJSON(c *gin.Context, code int, obj interface{})

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