gocommon

package module
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: May 28, 2021 License: MIT Imports: 4 Imported by: 0

README

gocommon 工具包

安装 模块 说明
go get github.com/youngchan1988/gocommon gocommon 常用判空、相等、包含等判断
go get github.com/youngchan1988/gocommon/cast cast interface 对其他数据类型的转换
go get github.com/youngchan1988/gocommon/decimalutils decimalutils 浮点数操作
go get github.com/youngchan1988/gocommon/fileutils fileutils 文件操作
go get github.com/youngchan1988/gocommon/safelist safelist 线程安全列表
go get github.com/youngchan1988/gocommon/safemap safemap 线程安全字典
go get github.com/youngchan1988/gocommon/securityutils securityutils 常用加/解密,md5等
go get github.com/youngchan1988/gocommon/sliceutils sliceutils Slice常用操作
go get github.com/youngchan1988/gocommon/stringutils stringutils 常用字符串操作
go get github.com/youngchan1988/gocommon/syncutils syncutils 同步锁操作

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsContains

func IsContains(container, item interface{}) bool

IsContains 判断 container 是否包含了 item 的内容。若是指针,会判断指针指向的内容, 但是不支持多重指针。

若 container 是字符串(string、[]byte和[]rune,不包含 fmt.Stringer 接口), 都将会以字符串的形式判断其是否包含 item。 若 container是个列表(array、slice、map)则判断其元素中是否包含 item 中的 的所有项,或是 item 本身就是 container 中的一个元素。

func IsEmpty

func IsEmpty(expr interface{}) bool

IsEmpty 判断一个值是否为空(0, "", false, 空数组等)。 []string{""}空数组里套一个空字符串,不会被判断为空。

func IsEqual

func IsEqual(v1, v2 interface{}) bool

IsEqual 判断两个值是否相等。

除了通过 reflect.DeepEqual() 判断值是否相等之外,一些类似 可转换的数值也能正确判断,比如以下值也将会被判断为相等:

int8(5)                     == int(5)
[]int{1,2}                  == []int8{1,2}
[]int{1,2}                  == [2]int8{1,2}
[]int{1,2}                  == []float32{1,2}
map[string]int{"1":"2":2}   == map[string]int8{"1":1,"2":2}

// map的键值不同,即使可相互转换也判断不相等。
map[int]int{1:1,2:2}        != map[int8]int{1:1,2:2}

func IsNil

func IsNil(expr interface{}) bool

IsNil 判断一个值是否为 nil。 当特定类型的变量,已经声明,但还未赋值时,也将返回 true

Types

This section is empty.

Directories

Path Synopsis
decimal
Package decimal provides a high-performance, arbitrary precision, floating-point decimal library.
Package decimal provides a high-performance, arbitrary precision, floating-point decimal library.
decimal/internal/arith
Package arith provides performance-sensitive arithmetic operations.
Package arith provides performance-sensitive arithmetic operations.
decimal/internal/c
Package c provides internal constants.
Package c provides internal constants.
decimal/math
Package math implements various useful mathematical functions and constants.
Package math implements various useful mathematical functions and constants.
decimal/misc
Package misc contains miscellaneous decimal routes.
Package misc contains miscellaneous decimal routes.
decimal/suite
Package suite provides a simple API for parsing and using IBM Labs' "Floating-Point Test-Suite for IEEE" This package is deprecated and will be removed in the next major version.
Package suite provides a simple API for parsing and using IBM Labs' "Floating-Point Test-Suite for IEEE" This package is deprecated and will be removed in the next major version.
* Author: YoungChan * Date: 2020-07-22 17:23:08 * LastEditors: YoungChan * LastEditTime: 2020-09-02 18:27:43 * Description: file content
* Author: YoungChan * Date: 2020-07-22 17:23:08 * LastEditors: YoungChan * LastEditTime: 2020-09-02 18:27:43 * Description: file content
Package network Author: youngchan CreateDate: 2021/5/7 3:30 下午 Copyright: ©2021 NEW CORE Technology Co.
Package network Author: youngchan CreateDate: 2021/5/7 3:30 下午 Copyright: ©2021 NEW CORE Technology Co.
Package ziputils Author: youngchan CreateDate: 2021/5/28 4:25 下午 Copyright: ©2021 NEW CORE Technology Co.
Package ziputils Author: youngchan CreateDate: 2021/5/28 4:25 下午 Copyright: ©2021 NEW CORE Technology Co.

Jump to

Keyboard shortcuts

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