util

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: MIT Imports: 6 Imported by: 1 module, 1 package

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.

README

go-util

Utility package for Golang

Documentation

Index

Constants

View Source
const (
	JsonTag = "json"
	DbTag   = "db"
	YamlTag = "yaml"
	TomlTag = "toml"
)

list of known struct tag key

Variables

This section is empty.

Functions

func IsZero

func IsZero(i interface{}) bool

IsZero return true if given parameter is set to zero value

func MapKeys

func MapKeys(m map[string]interface{}) []string

MapKeys return map keys

func Pretty

func Pretty(v interface{}) []byte

Pretty convert value to pretty json

func PrettyColor

func PrettyColor(v interface{}) []byte

PrettyColor convert value to colored json

func PrettyColorStr

func PrettyColorStr(v interface{}) string

PrettyColorStr convert type to JSON with color

func PrettyStr

func PrettyStr(v interface{}) string

PrettyStr convert value to pretty json string

func StringsContains

func StringsContains(strSlice []string, str string) bool

StringsContains check wether str is in the slice

func StringsContainsFold

func StringsContainsFold(strSlice []string, str string) bool

StringsContainsFold check wether str is in the slice

func StructTag

func StructTag(v interface{}, fieldName, key string) string

StructTag return associated tag for given field and tag key

func StructTags

func StructTags(v interface{}, key string) ([]string, error)

StructTags list tags for given data

func StructToMap

func StructToMap(v interface{}) (map[string]interface{}, error)

StructToMap expands struct/map to map[string]interface{} If v already a map, it simply return v

func StructToMapTag

func StructToMapTag(v interface{}, key string) (map[string]interface{}, error)

StructToMapTag expands struct/map to map[string]interface{} If v already a map, it simply return v

Types

This section is empty.

Jump to

Keyboard shortcuts

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