utils

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(data bool) *bool

func Byte

func Byte(data byte) *byte

func CamelToSnake

func CamelToSnake(camel string) string

func CentToYuan

func CentToYuan(cent int64) float64

CentToYuan int64 类型的人民币分单位值转换为元单位的值

func CheckFileMD5

func CheckFileMD5(file string, tagMd5Value string) (bool, error)

CheckFileMD5 检查文件的 md5 值

func ContainInt

func ContainInt(src []int, tag int) bool

func ContainString

func ContainString(src []string, tag string) bool

func ConvertPointer

func ConvertPointer(t reflect.Type) reflect.Type

ConvertPointer 将一个类型转换为指针类型

func CreateNewFile

func CreateNewFile(path string) (*os.File, error)

CreateNewFile 创建新的文件 文件如果存在的话 会删除旧文件创建新文件并返回

func FileExist

func FileExist(filePath string) (bool, error)

func FileName

func FileName(file string) string

func Float64

func Float64(data float64) *float64

func GET

func GET(url string, pathParams, queryParams ReqParams) ([]byte, error)

func GetConfigurationItem

func GetConfigurationItem(prefix, item string) string

func GetFileName

func GetFileName(file string) string

func HexToRGBA

func HexToRGBA(hexColor string) (*color.RGBA, error)

func Int

func Int(data int) *int

func Int16

func Int16(data int16) *int16

func Int32

func Int32(data int32) *int32

func Int64

func Int64(data int64) *int64

func Int8

func Int8(data int8) *int8

func IntCentToYuan

func IntCentToYuan(cent int) float64

IntCentToYuan int 类型的人民币分单位值转换为元单位的值

func IsFunc

func IsFunc(i interface{}) bool

IsFunc 判断一个值是否是一个函数

func IsNilPointer

func IsNilPointer(i interface{}) bool

IsNilPointer 判断一个值是否是一个空指针

func NoPanic

func NoPanic(fn func()) (err error)

func POST

func POST(uri string, body Body) (*gjson.Result, error)

func ParseConfig

func ParseConfig(conf string) ([]string, error)

func PasswordEncode

func PasswordEncode(password string) string

func PathExist

func PathExist(path string) (bool, error)

PathExist 检查路径是否不存在

func RegexpMatchPhone

func RegexpMatchPhone(phone string) bool

RegexpMatchPhone 正则匹配手机号

func RemoveTypePtr

func RemoveTypePtr(t reflect.Type) reflect.Type

RemoveTypePtr 移除一个类型的指针

func RemoveValuePtr

func RemoveValuePtr(v reflect.Value) reflect.Value

RemoveValuePtr 移除一个值的指针

func ReplaceFileDir

func ReplaceFileDir(srcFile, replaceDir string) string

func SnakeToCamel

func SnakeToCamel(snake string) string

func String

func String(data string) *string

func StringCentToYuan

func StringCentToYuan(cent string) float64

StringCentToYuan 字符串类型的人民币分单位值转换为元单位的值

func StringYuanToCent

func StringYuanToCent(yuan string) int64

StringYuanToCent 字符串类型的人民币元单位的值转换为分单位的值

func StructToMap

func StructToMap(in interface{}, omits ...string) (map[string]interface{}, error)

StructToMap 将一个结构体转换为 map[string]interface{}

func UUID

func UUID() string

func Uint

func Uint(data uint) *uint

func Uint16

func Uint16(data uint16) *uint16

func Uint32

func Uint32(data uint32) *uint32

func Uint64

func Uint64(data uint64) *uint64

func Uint8

func Uint8(data uint8) *uint8

func UniqueId

func UniqueId(min, max int64) int64

UniqueId 获取新的唯一 ID

func Verify

func Verify(plaintext, encrypt string) bool

func YuanToCent

func YuanToCent(yuan float64) int64

YuanToCent 浮点类型的人民币元单位的值转换为分单位的值

Types

type Body

type Body map[string]interface{}

type ReqParams

type ReqParams map[string]string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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