helpers

package
v0.5.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetJson added in v0.5.2

func GetJson(ctx iris.Context, target interface{}) error

GetJson 获取body体中的json数据

func GetValidatedJson added in v0.5.2

func GetValidatedJson(ctx iris.Context, target interface{}) error

GetValidatedJson 获取通过validatMng验证过的json数据

func ReturnError added in v0.4.4

func ReturnError(ctx iris.Context, msg string)

*

  • @func: ReturnResult json格式返回
  • @author Wiidz
  • @date 2019-11-16

func ReturnResult added in v0.2.5

func ReturnResult(ctx iris.Context, message string, data interface{}, statusCode int)

Types

type CryptorHelper added in v0.3.9

type CryptorHelper struct{}

func (*CryptorHelper) MD5Encrypt added in v0.3.9

func (*CryptorHelper) MD5Encrypt(raw string) string

type LbsHelper

type LbsHelper struct{}

func (*LbsHelper) EarthDistance

func (lbsHelper *LbsHelper) EarthDistance(lat1, lng1, lat2, lng2 float64) float64

计算2点的距离 单位为米

type MapHelper

type MapHelper struct{}

func (*MapHelper) Equal

func (*MapHelper) Equal(m1, m2 map[string]interface{}) bool

*

  • @func: MapEqual 判断两个map内容相同
  • @author Wiidz
  • @date 2019-11-16

func (*MapHelper) Exist

func (*MapHelper) Exist(data map[string]interface{}, key string) bool

*

  • @func: Exist 判断map中是否包含某键值
  • @author Wiidz
  • @date 2019-11-16

func (*MapHelper) Filter

func (*MapHelper) Filter(target map[string]interface{}, fields []string)

*

  • @func: FilterMap 过滤map 删除fields以外的键
  • @author Wiidz
  • @date 2019-11-16

func (*MapHelper) GetFloat64Keys

func (*MapHelper) GetFloat64Keys(imap map[string]interface{}) []float64

*

  • @func: GetKeys 从 map[string]interface{} 中获取float64类型的键名
  • @author Wiidz
  • @date 2019-11-16

func (*MapHelper) GetInt64Keys

func (*MapHelper) GetInt64Keys(imap map[string]interface{}) []int64

*

  • @func: GetKeys 从 map[string]interface{} 中获取int64类型的键名
  • @author Wiidz
  • @date 2019-11-16

func (*MapHelper) GetIntKeys

func (*MapHelper) GetIntKeys(imap map[string]interface{}) []int

*

  • @func: GetKeys 从 map[string]interface{} 中获取整数类型的键名
  • @author Wiidz
  • @date 2019-11-16

func (*MapHelper) GetIntKeysFromIntKeyMap

func (*MapHelper) GetIntKeysFromIntKeyMap(imap map[int]bool) []int

*

  • @func: GetKeys 从 map[string]interface{} 中获取整数类型的键名
  • @author Wiidz
  • @date 2019-11-16

func (*MapHelper) GetKeys

func (*MapHelper) GetKeys(imap map[string]interface{}) []string

*

  • @func: GetKeys 从 map[string]interface{} 中获取键名
  • @author Wiidz
  • @date 2019-11-16

func (*MapHelper) GetKeysPlus

func (*MapHelper) GetKeysPlus(imap map[string]map[string]interface{}) []string

*

  • @func: GetKeysPlus 从 map[string]map[string]interface{} 中获取一级键名
  • @author Wiidz
  • @date 2019-11-16

func (*MapHelper) GetValues

func (*MapHelper) GetValues(imap map[string]interface{}) []interface{}

*

  • @func: GetValues 从 map[string]interface{} 中输出所有的键值到一个[]interface{}数组中
  • @author Wiidz
  • @date 2019-11-16

func (*MapHelper) HasIllegalKey

func (*MapHelper) HasIllegalKey(target map[string]interface{}, fields []string) bool

*

  • @func: HasIllegalKey 判断map是否包含规定以外的键
  • @author Wiidz
  • @date 2019-11-06

type MathHelper

type MathHelper struct{}

func (*MathHelper) GetBezierPoints

func (mathHelper *MathHelper) GetBezierPoints(dots []map[string]float64, amount int) []map[string]float64

*

  • @func: GetBezierPoints 获取贝塞尔曲线上的所有规定数量的点
  • @author Wiidz
  • @date 2019-11-16

func (*MathHelper) GetInsideDots

func (mathHelper *MathHelper) GetInsideDots(dots1 map[float64]map[string]float64, dots2 map[float64]map[string]float64) []map[string]float64

*

  • @func: GetInsideDots 获取两组点构成的线,包围区域中间的点
  • @author Wiidz
  • @date 2019-11-16

func (*MathHelper) GetIntergers

func (*MathHelper) GetIntergers(border1 float64, border2 float64, narrow_range float64, amount float64) []float64

*

  • @func: GetIntergers 获取两个数之间指定数量的等分点
  • @author Wiidz
  • @date 2019-11-16

func (*MathHelper) GetNearestIntXDots

func (*MathHelper) GetNearestIntXDots(dots []map[string]float64) map[float64]map[string]float64

*

  • @func: GetNearestIntXDots 获取一组点中最接近整数x的点
  • @author Wiidz
  • @date 2019-11-16

func (*MathHelper) GetRandomFloat64 added in v0.1.4

func (*MathHelper) GetRandomFloat64() (num float64)

*

  • @func: GetRandomInt 获取范围内的int随机数
  • @author Wiidz
  • @date 2021-06-19

func (*MathHelper) GetRandomInt

func (*MathHelper) GetRandomInt(min, max int) (num int)

*

  • @func: GetRandomInt 获取范围内的int随机数
  • @author Wiidz
  • @date 2019-11-16

func (*MathHelper) Keep

func (*MathHelper) Keep(number float64, amount int) float64

func (*MathHelper) MatrixTransform

func (*MathHelper) MatrixTransform(data []float64, matrix [][]float64) []float64

*

  • @func: MatrixTransform 矩阵变换
  • @author Wiidz
  • @date 2019-11-16

type Method added in v0.2.9

type Method int8
const (
	Get     Method = 1
	Post    Method = 2
	Put     Method = 3
	Delete  Method = 4
	Options Method = 5
)

func (Method) String added in v0.2.9

func (p Method) String() string

type NetworkHelper

type NetworkHelper struct{}

func (*NetworkHelper) DownloadFile

func (networkHelper *NetworkHelper) DownloadFile(targetURL, localPath string) (fileName, pathString string, err error)

*

  • @func: DownloadFile 下载目标文件到本地
  • @author: Wiidz
  • @date: 2021-6-20

func (*NetworkHelper) DownloadFileWithFormat added in v0.2.3

func (*NetworkHelper) DownloadFileWithFormat(targetURL, localPath, format string, headers map[string]string) (fileName, tempPath string, header *http.Header, err error)

*

  • @func: DownloadFileWithFormat 下载目标文件到本地,强制命名格式
  • @author: Wiidz
  • @date: 2021-6-20

func (*NetworkHelper) GetParsedURL added in v0.3.1

func (networkHelper *NetworkHelper) GetParsedURL(apiURL string, params map[string]interface{}) (string, error)

*

  • @func: GetParsedURL 获取get地址
  • @author: Wiidz
  • @date: 2021-06-20

func (*NetworkHelper) GetRequest

func (networkHelper *NetworkHelper) GetRequest(apiURL string, params map[string]interface{}) (map[string]interface{}, *http.Header, error)

*

  • @func: GetRequest 发送get请求
  • @author: Wiidz
  • @date: 2021-06-20

func (*NetworkHelper) ParamsInvalid added in v0.5.2

func (*NetworkHelper) ParamsInvalid(ctx iris.Context, err error)

*

  • @func: ReturnResult json格式返回
  • @author Wiidz
  • @date 2019-11-16

func (*NetworkHelper) PostJsonRequest added in v0.3.0

func (*NetworkHelper) PostJsonRequest(apiURL string, params map[string]interface{}) ([]byte, error)

*

  • @func: PostRequest 发送post请求
  • @author Wiidz
  • @date 2019-11-16

func (*NetworkHelper) PostRequest

func (networkHelper *NetworkHelper) PostRequest(apiURL string, params map[string]interface{}) (map[string]interface{}, *http.Header, error)

*

  • @func: PostRequest 发送post请求
  • @author: Wiidz
  • @date: 2021-6-20

func (*NetworkHelper) RequestJson added in v0.5.2

func (*NetworkHelper) RequestJson(method Method, targetURL string, params map[string]interface{}, headers map[string]string) (map[string]interface{}, *http.Header, int, error)

func (*NetworkHelper) RequestJsonTest added in v0.5.2

func (*NetworkHelper) RequestJsonTest(method Method, targetURL string, params map[string]interface{}, headers map[string]string) (map[string]interface{}, *http.Header, int, error)

func (*NetworkHelper) RequestRaw added in v0.5.2

func (*NetworkHelper) RequestRaw(method Method, targetURL string, params map[string]interface{}, headers map[string]string) (string, *http.Header, int, error)

func (*NetworkHelper) RequestRawTest added in v0.5.2

func (*NetworkHelper) RequestRawTest(method Method, targetURL string, params map[string]interface{}, headers map[string]string) (string, *http.Header, int, error)

type OsHelper

type OsHelper struct{}

func (*OsHelper) DownloadFile

func (osHelper *OsHelper) DownloadFile(url string, localPath string, fb func(length, downLen int64)) error

*

  • @func: DownloadFile 从url中下载文件
  • @author Wiidz
  • @date 2019-11-16

func (*OsHelper) ExistFile

func (*OsHelper) ExistFile(filename string, filesize int64) bool

*

  • @func: ExistFile 判断文件是否已存在
  • @author Wiidz
  • @date 2019-11-16

func (*OsHelper) GetFileBuf

func (*OsHelper) GetFileBuf(uri string) []byte

func (*OsHelper) ReadJsonFile

func (*OsHelper) ReadJsonFile(filePath string) map[string]interface{}

*

  • @func: ReadJsonFile 读取json格式的文件
  • @author Wiidz
  • @date 2019-11-16

type Set

type Set struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

集合模拟

func NewSet

func NewSet() *Set

func (*Set) Add

func (s *Set) Add(item int)

func (*Set) Clear

func (s *Set) Clear()

func (*Set) Has

func (s *Set) Has(item int) bool

func (*Set) IsEmpty

func (s *Set) IsEmpty() bool

func (*Set) Len

func (s *Set) Len() int

func (*Set) List

func (s *Set) List() []int

func (*Set) Remove

func (s *Set) Remove(item int)

func (*Set) SortList

func (s *Set) SortList() []int

type SliceHelper

type SliceHelper struct{}

func (*SliceHelper) ArrayFilter

func (*SliceHelper) ArrayFilter(a []interface{}) (ret []interface{})

*

  • @func: ArrayFilter 不知道
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) ArrayGroupByMapKey

func (*SliceHelper) ArrayGroupByMapKey(key string, list []map[string]interface{}) [][]map[string]interface{}

*

  • @func: ArrayGroupByMapKey 以一个数组map 中的某一个key 进行分组
  • @author Wiidz
  • @date 2019-11-16

func (*SliceHelper) Diffrence

func (*SliceHelper) Diffrence(arr_1 []int64, arr_2 []int64) []int64

*

  • @func: ArrayIntersect 取出两个slice的差集
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) DiffrenceFloat64

func (*SliceHelper) DiffrenceFloat64(arr_1 []float64, arr_2 []float64) []float64

*

  • @func: ArrayIntersect 取出两个slice的差集
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) Exist

func (*SliceHelper) Exist(needle interface{}, hystack_array interface{}) bool

*

  • @func: Exsit 判断slice中是否存在needle
  • @author Wiidz
  • @date 2019-11-16

func (*SliceHelper) ExistInt added in v0.1.9

func (*SliceHelper) ExistInt(needle int, hystackArray []int) bool

*

  • @func: Exsit 判断slice中是否存在needle
  • @author Wiidz
  • @date 2019-11-16

func (*SliceHelper) Float64SliceDelete

func (*SliceHelper) Float64SliceDelete(slice []float64, index int) []float64

*

  • @func: SliceDelete 返回新slice(不包含指定的那个index键)
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) Float64SliceSum

func (*SliceHelper) Float64SliceSum(arr []float64) float64

*

  • @func: Float64SliceSum float64切片求和
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) GetFloat64FromInt64MapSlice

func (*SliceHelper) GetFloat64FromInt64MapSlice(d []map[string]interface{}, column_key string) []float64

*

  • @func: SkuList 从map slice中获取键值 int64 slice
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) GetFloat64FromInterfaceSlice

func (*SliceHelper) GetFloat64FromInterfaceSlice(d []interface{}, column_key string) []float64

*

  • @func: GetFloat64FromMapSlice 从map slice中获取键值float64 slice
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) GetFloat64FromMapSlice

func (*SliceHelper) GetFloat64FromMapSlice(d []map[string]interface{}, column_key string) []float64

*

  • @func: GetFloat64FromMapSlice 从map slice中获取键值float64 slice
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) GetInt64FromInterfaceSlice

func (*SliceHelper) GetInt64FromInterfaceSlice(d []interface{}, column_key string) []int64

*

  • @func: GetFloat64FromMapSlice 从map slice中获取键值float64 slice
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) GetInt64FromMapSlice

func (*SliceHelper) GetInt64FromMapSlice(d []map[string]interface{}, column_key string) []int64

*

  • @func: SkuList 从map slice中获取键值 int64 slice
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) GetIntFromInterfaceSlice

func (*SliceHelper) GetIntFromInterfaceSlice(d []interface{}, column_key string) []int

*

  • @func: GetFloat64FromMapSlice 从map slice中获取键值float64 slice
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) GetIntFromMapSlice

func (*SliceHelper) GetIntFromMapSlice(d []map[string]interface{}, column_key string) []int

*

  • @func: GetIntFromMapSlice 从map slice中获取键值 int slice
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) GetIntFromMapSliceByInt64

func (*SliceHelper) GetIntFromMapSliceByInt64(d []map[string]interface{}, column_key string) []int

*

  • @func: SkuList 从map slice中获取键值 int64 slice
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) GetParentIds

func (sliceHelper *SliceHelper) GetParentIds(children_id, result_str, key string, original_data []map[string]interface{}) string

*

  • @func: GetParentIds 递归查找父级逗号隔开从高到低
  • @author Wiidz
  • @date 2019-11-16

func (*SliceHelper) GetRange

func (*SliceHelper) GetRange(min float64, max float64, step float64) []float64

*

  • @func: GetRange 类似php的函数,获取范围内的整数集合
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) GetValuesFromInterfaceSlice

func (*SliceHelper) GetValuesFromInterfaceSlice(d []interface{}, column_key string) []interface{}

*

  • @func: GetValuesFromInterface 从interface slice中获取键值slice
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) GetValuesFromMapSlice

func (*SliceHelper) GetValuesFromMapSlice(d []map[string]interface{}, column_key string) []interface{}

*

  • @func: GetValuesFromMapSlice 从map slice中获取键值slice
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) IndexOf

func (*SliceHelper) IndexOf(needle interface{}, hystack_array interface{}) int

*

  • @func: IndexOfStrSlice 从slice中,寻找指定内容的键值
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) IndexOfStrSlice

func (*SliceHelper) IndexOfStrSlice(needle string, fields_slice []string) int

*

  • @func: IndexOfStrSlice 从str slice中,寻找指定内容的键值
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) Int64Slice2Float64Slice

func (*SliceHelper) Int64Slice2Float64Slice(data []int64) []float64

func (*SliceHelper) Int64SliceDelete

func (*SliceHelper) Int64SliceDelete(slice []int64, index int) []int64

*

  • @func: SliceDelete 返回新slice(不包含指定的那个index键)
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) IntSliceDelete

func (*SliceHelper) IntSliceDelete(slice []int, index int) []int

*

  • @func: SliceDelete 返回新slice(不包含指定的那个index键)
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) InterfaceSlice2SimpleMap

func (*SliceHelper) InterfaceSlice2SimpleMap(data []interface{}, index, key string) map[string]interface{}

func (*SliceHelper) InterfaceSliceSum

func (*SliceHelper) InterfaceSliceSum(arr []interface{}) float64

*

  • @func: InterfaceSliceSum float64切片求和
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) Intersect

func (*SliceHelper) Intersect(arr_1 []interface{}, arr_2 []interface{}) []interface{}

*

  • @func: ArrayIntersect 取出两个slice的交集
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) IntersectFloat64

func (*SliceHelper) IntersectFloat64(arr_1 []float64, arr_2 []float64) []float64

*

  • @func: ArrayIntersect 取出两个slice的交集
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) IntersectInt

func (*SliceHelper) IntersectInt(arr_1 []int64, arr_2 []int64) []int64

*

  • @func: ArrayIntersect 取出两个slice的交集
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) Join

func (*SliceHelper) Join(islice []string, letter string) string

func (*SliceHelper) JoinInterfaceSlice

func (*SliceHelper) JoinInterfaceSlice(islice []interface{}, letter string) string

func (*SliceHelper) MapSlice2SimpleMap

func (*SliceHelper) MapSlice2SimpleMap(data []map[string]interface{}, index, key string) map[string]interface{}

func (*SliceHelper) MapSliceDelete

func (*SliceHelper) MapSliceDelete(slice []map[string]interface{}, index int) []map[string]interface{}

*

  • @func: StrSliceDelete 返回新slice(不包含指定的那个index键)
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) MapSliceReverse

func (*SliceHelper) MapSliceReverse(arr []map[string]interface{}) ([]map[string]interface{}, error)

*

  • @func: MapSliceReverse 将map slice倒过来排
  • @author Wiidz
  • @date 2019-11-16

func (*SliceHelper) Merge

func (*SliceHelper) Merge(arr_1 []map[string]float64, arr_2 []map[string]float64) []map[string]float64

*

  • @func: sliceMerge 合并两个slice
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) NarrowSlice

func (*SliceHelper) NarrowSlice(arr []map[string]interface{}, amount int) []map[string]interface{}

*

  • @func: NarrowSlice 缩短slice,取中间部分
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) Paginator

func (*SliceHelper) Paginator(page, pageSize int, data []map[string]interface{}) []map[string]interface{}

*

  • @func: Paginator 组装分页
  • @author Wiidz
  • @date 2019-11-16

func (*SliceHelper) Slice2MapByInt64ColumnAsKey

func (*SliceHelper) Slice2MapByInt64ColumnAsKey(data []map[string]interface{}, index string) map[string]interface{}

func (*SliceHelper) SliceDelete

func (*SliceHelper) SliceDelete(slice []interface{}, index int) []interface{}

*

  • @func: SliceDelete 返回新slice(不包含指定的那个index键)
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) StrSliceDelete

func (*SliceHelper) StrSliceDelete(slice []string, index int) []string

*

  • @func: StrSliceDelete 返回新slice(不包含指定的那个index键)
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) UniqueByLoop

func (*SliceHelper) UniqueByLoop(slc []int) []int

*

  • @func: UniqueByLoop 通过两重循环过滤重复元素
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) UniqueByMap

func (*SliceHelper) UniqueByMap(slc []int) []int

*

  • @func: UniqueByMap 通过map主键唯一的特性过滤重复元素
  • @author Wiidz
  • @date 2019-11-16

func (*SliceHelper) UniqueIntSlice

func (sliceHelper *SliceHelper) UniqueIntSlice(slc []int) []int

*

  • @func: UniqueIntSlice int slice去重
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) UniqueInterface

func (*SliceHelper) UniqueInterface(slc []interface{}) []interface{}

*

  • @func: UniqueInterface interface slice去重
  • @author Wiidz
  • @date 2019-11-06

func (*SliceHelper) UniqueStrSlice

func (*SliceHelper) UniqueStrSlice(strSlice []string) []string

*

  • @func: UniqueStrSlice str slice去重
  • @author Wiidz
  • @date 2019-11-16

type Snowflake

type Snowflake struct {
	sync.Mutex
	// contains filtered or unexported fields
}

A Snowflake struct holds the basic information needed for a snowflake generator worker

func NewSnowflake

func NewSnowflake(workerid int64) (*Snowflake, error)

NewNode returns a new snowflake worker that can be used to generate snowflake IDs

func NewSnowflakeMax

func NewSnowflakeMax() (*Snowflake, error)

NewNode returns a new snowflake worker that can be used to generate snowflake IDs

func (*Snowflake) Generate

func (s *Snowflake) Generate() int64

Generate creates and returns a unique snowflake ID

type StrHelper

type StrHelper struct{}

func (*StrHelper) Base64Decode added in v0.1.3

func (*StrHelper) Base64Decode(str string) (data []byte)

*

  • @func: Base64_decode 解码
  • @author Wiidz
  • @date 2019-11-16

func (*StrHelper) Base64Encode added in v0.1.3

func (*StrHelper) Base64Encode(src []byte) (str string)

*

  • @func: Base64_encode base64编码
  • @author Wiidz
  • @date 2019-11-16

func (*StrHelper) GetRandomString

func (*StrHelper) GetRandomString(l int) string

*

  • @func: GetRandomString 获取指定位数的随机字符串
  • @author Wiidz
  • @date 2019-11-16

func (*StrHelper) GetWordsLength

func (*StrHelper) GetWordsLength(str string) float64

*

  • @func: GetWordLength 文字=1,标点符号=0.5,获取长度
  • @author Wiidz
  • @date 2019-11-16

func (*StrHelper) StripTags

func (*StrHelper) StripTags(body string) string

*

  • @func: StripTags 去除文本中的html标签
  • @author Wiidz
  • @date 2019-11-16

func (*StrHelper) Substr

func (*StrHelper) Substr(s string, start, length int) string

*

  • @func: Substr 截取字符串
  • @author Wiidz
  • @date 2019-11-16

func (*StrHelper) Trim

func (*StrHelper) Trim(str string) (data string)

*

  • @func: Trim 过滤空字符串(不可靠)
  • @author Wiidz
  • @date 2019-11-16

func (*StrHelper) ValidatePhone

func (*StrHelper) ValidatePhone(phoneNum string) bool

*

  • @func:正则验证是否是手机号
  • @author Hank
  • @date 2019-02-24

type StructHelper

type StructHelper struct{}

func (*StructHelper) GetStructAllFields added in v0.5.2

func (*StructHelper) GetStructAllFields(target interface{})

*

  • @func: GetStructAllFields 打印结构体的所有键值
  • @author Wiidz
  • @date 2019-11-16

func (*StructHelper) GetStructAllKV added in v0.5.2

func (*StructHelper) GetStructAllKV(target interface{})

*

  • @func: GetStructAllFields 打印结构体的所有键值对
  • @author Wiidz
  • @date 2019-11-16

func (*StructHelper) GetStructAllMethods added in v0.5.2

func (*StructHelper) GetStructAllMethods(target interface{})

*

  • @func: GetStructAllMethods 打印结构体的所有方法
  • @author Wiidz
  • @date 2019-11-16

func (*StructHelper) GetStructPointAllKV added in v0.5.2

func (*StructHelper) GetStructPointAllKV(target interface{})

*

  • @func: GetStructAllFields 打印结构体的所有键值对
  • @author Wiidz
  • @date 2019-11-16

type TimeHelper

type TimeHelper struct{}

func (*TimeHelper) BeautyTimeStamp

func (*TimeHelper) BeautyTimeStamp(timeStamp, currentTime int64) string

func (*TimeHelper) FromTodayToTomorrowTimeStamp

func (*TimeHelper) FromTodayToTomorrowTimeStamp() (today, tomorrow int64)

*

  • @func: FromTodayToTomorrowTimeStamp 返回今天凌晨和明天凌晨的时间戳
  • @author Wiidz
  • @date 2019-11-16

func (*TimeHelper) GetISO8601

func (*TimeHelper) GetISO8601(date int64) string

*

  • @func: GetISO8601 获取iso8601格式的时间
  • @author Wiidz
  • @date 2019-11-16

func (*TimeHelper) GetZeroTimeStamp

func (*TimeHelper) GetZeroTimeStamp(d time.Time) time.Time

*

  • @func: GetZeroTimeStamp 获取某一天的0点时间
  • @author Wiidz
  • @date 2019-11-16

func (*TimeHelper) LastDayOfTimeStamp

func (timeHelper *TimeHelper) LastDayOfTimeStamp(d time.Time) int64

*

  • @func: LastDayOfTimeStamp 获取本日最后一天的时间戳
  • @author Wiidz
  • @date 2019-11-16

type TypeHelper

type TypeHelper struct{}

func (*TypeHelper) Bytes2Int added in v0.1.6

func (*TypeHelper) Bytes2Int(b []byte) int

字节转换成整形

func (*TypeHelper) Empty

func (typeHelper *TypeHelper) Empty(arg interface{}) bool

*

  • @func: Empty 判断目标是否为空值或0
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) Explode

func (*TypeHelper) Explode(data string, sep string) []interface{}

*

  • @func: Explode 字符串转slice, 接受混合类型
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) ExplodeFloat64

func (*TypeHelper) ExplodeFloat64(data string, sep string) []float64

*

  • @func: Explode 字符串转int slice
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) ExplodeInt

func (*TypeHelper) ExplodeInt(data string, sep string) []int

*

  • @func: Explode 字符串转int slice
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) ExplodeInt64

func (*TypeHelper) ExplodeInt64(data string, sep string) []int64

*

  • @func: Explode 字符串转int slice
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) Float64Slice2IntSlice

func (*TypeHelper) Float64Slice2IntSlice(slice []interface{}) []int

*

  • @func: Float64SliceToInt float64 slice转换成 int slice
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) Float64ToStr

func (*TypeHelper) Float64ToStr(number float64) string

*

  • @func: Str2Int 将字符串转为int
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) GetType

func (*TypeHelper) GetType(params interface{}) string

*

  • @func: GetType 获取目标的数据类型
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) If

func (*TypeHelper) If(conditions bool, trueVal, falseVal interface{}) interface{}

*

  • @func: If 三元运算符
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) Implode

func (typeHelper *TypeHelper) Implode(data interface{}, glue string) string

*

  • @func: Implode 将slice转换成字符串
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) Int2Bytes added in v0.1.6

func (*TypeHelper) Int2Bytes(n int) []byte

整形转换成字节

func (*TypeHelper) Int2Str

func (*TypeHelper) Int2Str(number int) string

*

  • @func: Float64SliceToInt float64 slice转换成 int slice
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) Int64Slice2IntSlice

func (*TypeHelper) Int64Slice2IntSlice(int64_slice []int64) []int

func (*TypeHelper) Int64ToStr

func (*TypeHelper) Int64ToStr(number int64) string

*

  • @func: Int64ToStr int64转为str
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) InterfaceSlice2MapSlice

func (*TypeHelper) InterfaceSlice2MapSlice(inter []interface{}) []map[string]interface{}

*

  • @func: InterfaceSlice2MapSlice interface slice 转换 map slice
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) IsNil

func (*TypeHelper) IsNil(i interface{}) bool

func (*TypeHelper) IsType

func (*TypeHelper) IsType(needle interface{}, type_name string) bool

*

  • @func: IsType 判断目标是否为指定类型的值
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) JsonDecode

func (*TypeHelper) JsonDecode(json_str string) map[string]interface{}

*

  • @func: JsonDecode 解码json
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) JsonDecodeInt64Slice

func (*TypeHelper) JsonDecodeInt64Slice(json_str string) []int64

*

  • @func: JsonDecode 解码json
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) JsonDecodeWithStruct

func (*TypeHelper) JsonDecodeWithStruct(json_str string, istruct interface{}) interface{}

*

  • @func: JsonDecode 解码json
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) JsonEncode

func (*TypeHelper) JsonEncode(data interface{}) (string, error)

*

  • @func: JsonEncode 编码json
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) Map2InterfaceSlice

func (*TypeHelper) Map2InterfaceSlice(data map[string]interface{}) []interface{}

*

  • @func: Map2InterfaceSlice 将map转换成interface slice
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) Str2Float64

func (*TypeHelper) Str2Float64(str string) float64

*

  • @func: Str2Float64 str转为float64
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) Str2Int

func (*TypeHelper) Str2Int(str string) int

*

  • @func: Str2Int 将字符串转为int
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) Str2Int64

func (*TypeHelper) Str2Int64(str string) int64

*

  • @func: Str2Int64 将字符串转为int64
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) Str2Int8

func (*TypeHelper) Str2Int8(str string) int8

*

  • @func: Str2Int8 将字符串转为int8
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) StrSlice2InterfaceSlice

func (*TypeHelper) StrSlice2InterfaceSlice(data []string) []interface{}

*

  • @func: StrSlice2InterfaceSlice 字符串slice转interface slice
  • @author Wiidz
  • @date 2019-11-16

func (*TypeHelper) ToString

func (*TypeHelper) ToString(data interface{}) string

*

  • @func: ToString 将任何参数转换为字符串
  • @author Wiidz
  • @date 2019-11-16

Jump to

Keyboard shortcuts

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