ysutils

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeInt     = "int"
	TypeInt8    = "int8"
	TypeInt16   = "int16"
	TypeInt32   = "int32"
	TypeInt64   = "int64"
	TypeUint    = "uint"
	TypeUint8   = "uint8"
	TypeUint16  = "uint16"
	TypeUint32  = "uint32"
	TypeUint64  = "uint64"
	TypeFloat32 = "float32"
	TypeFloat64 = "float64"
	TypeBool    = "bool"
	TypeString  = "string"
)
View Source
const DefaultRunConfig = "./config/config.toml"

Variables

This section is empty.

Functions

func DumpToString added in v1.0.1

func DumpToString(value interface{}, option gutil.DumpOption) string

func FileNumToInt added in v1.0.1

func FileNumToInt(s string) int

FileNumToInt 计算文件开头数字值

func FindAbsFile added in v1.0.1

func FindAbsFile(paths string, absPattern string) string

FindAbsFile 找到绝对匹配的文件 找到的我呢间

func FindFile added in v1.0.1

func FindFile(paths string, pattern string) string

func FindFiles added in v1.0.1

func FindFiles(paths string, pattern string) []string

FindFiles 在指定的路径 <paths> 中搜索指定匹配方法, <paths> 可以用 , 号分隔。

func FormatCommunicationRate

func FormatCommunicationRate(rate float64) (size string)

FormatCommunicationRate 通讯速率换算 传入参数单位为 B/s

func FormatFileSize

func FormatFileSize(fileSize int64) (size string)

FormatFileSize 字节的单位转换 保留两位小数

func GetExePath

func GetExePath() string

GetExePath 获取执行程序的路径

func GetMapFromCfg added in v1.0.1

func GetMapFromCfg(ctx context.Context, key string, name ...string) map[string]interface{}

GetMapFromCfg 从配置文件中将指定 key 的值读取为 map

func IsBaseType added in v0.9.0

func IsBaseType(t string) bool

IsBaseType 判断字符串 <t> 是不是 Go 语言的基本数据类型

func IsDebugMode added in v0.9.0

func IsDebugMode() bool

IsDebugMode 判断用户是否将程序运行在 debug 模式

func IsTypeBool added in v0.9.0

func IsTypeBool(t string) bool

func IsTypeFloatingPoint added in v0.9.0

func IsTypeFloatingPoint(t string) bool

func IsTypeInteger added in v0.9.0

func IsTypeInteger(t string) bool

func IsTypeNumber added in v0.9.0

func IsTypeNumber(t string) bool

func IsTypeString added in v0.9.0

func IsTypeString(t string) bool

func IsTypeUnsignedInteger added in v0.9.0

func IsTypeUnsignedInteger(t string) bool

func MapStrAnyMix

func MapStrAnyMix(maps ...map[string]interface{}) (out map[string]interface{})

func MapStrStrMix

func MapStrStrMix(maps ...map[string]string) (out map[string]string)

func ProcInstanceListen added in v1.0.1

func ProcInstanceListen()

func RemoveStringsFirst added in v0.7.0

func RemoveStringsFirst(strs []string, value string) []string

RemoveStringsFirst 删除数组中第一个找到的元素 删除成功返回删除后的值, 否则返回原值

func RunSql added in v0.9.1

func RunSql(ctx context.Context, sql string, name ...string) error

RunSql 执行 sql 语句, 执行异常时返回值为 error

func RunSqlFromFile added in v0.9.1

func RunSqlFromFile(ctx context.Context, path string, name ...string) error

RunSqlFromFile 通过文件执行 sql 语句。<path> 指代文件路径

func SetCfgFileNameEnv added in v1.0.4

func SetCfgFileNameEnv(file string)

SetCfgFileNameEnv 设置配置文件的文件名

func SetCfgPathEnv added in v1.0.4

func SetCfgPathEnv(path string)

SetCfgPathEnv 设置配置文件的搜索路径

Types

This section is empty.

Jump to

Keyboard shortcuts

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