utils

package
v0.0.0-...-eea6c30 Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRepeated

func IsRepeated(data interface{}) (bool, interface{})

判断一个数组中是否有重复元素

func JsonDecode

func JsonDecode(p []byte, v interface{}) error

JsonDecode 简单封装了json的UnMarshal功能 Example pingpp.JsonDecode(param1, param2) param1:需要转换成结构体的json数据 param2:转换后数据容器

func JsonEncode

func JsonEncode(v interface{}) ([]byte, error)

JsonEncode pingpp.JsonEncode(param1)

func MapToStruct

func MapToStruct(data map[string]interface{}, obj interface{}) error

用map填充结构

func Round

func Round(v float32) int

func Sha1Sign

func Sha1Sign(data string) string

func SliceMapToSlice

func SliceMapToSlice(datas []map[string]interface{}, objs []interface{})

func TypeConversion

func TypeConversion(value string, ntype string) (reflect.Value, error)

类型转换

Types

type Table

type Table struct {
	Header      []string
	Rows        [][]interface{}
	MaxCellSize int
}

func NewTable

func NewTable() *Table

func (*Table) Render

func (c *Table) Render() string

func (*Table) SetHeader

func (c *Table) SetHeader(header []string) *Table

func (*Table) SetMaxCellSize

func (c *Table) SetMaxCellSize(maxCellSize int) *Table

func (*Table) UseObj

func (c *Table) UseObj(obj interface{}) *Table

type WaitGroupWrapper

type WaitGroupWrapper struct {
	sync.WaitGroup
}

func (*WaitGroupWrapper) WaitTimeout

func (wg *WaitGroupWrapper) WaitTimeout(timeout time.Duration) bool

func (*WaitGroupWrapper) Wrap

func (wg *WaitGroupWrapper) Wrap(cb func())

Jump to

Keyboard shortcuts

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