utils

package
v0.0.0-...-33e1650 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const BaseNumber = "0123456789"

Variables

This section is empty.

Functions

func FirstLower

func FirstLower(s string) string

FirstLower 字符串首字母小写

func FirstUpper

func FirstUpper(s string) string

FirstUpper 字符串首字母大写

func FloatDecimal

func FloatDecimal(value float64, format string) float64

FloatDecimal 浮点数格式化

func FloatDecimal2

func FloatDecimal2(value float64) float64

FloatDecimal2 浮点数格式化

func GetLocalIp

func GetLocalIp() string

GetLocalIp 获取本机网卡 IP

func GetWriteSyncer

func GetWriteSyncer() (zapcore.WriteSyncer, error)

func If

func If(condition bool, trueVal, falseVal interface{}) interface{}

If 三木运算符实现

func InSliceIndex

func InSliceIndex(items []string, item string) int

InSliceIndex 字符串在 slice 中的下标,没有返回 -1

func JsonToMap

func JsonToMap(jsonStr string) map[string]interface{}

JsonToMap Convert json string to map

func PathExists

func PathExists(path string) (bool, error)

func RandomNumbers

func RandomNumbers(length int) string

RandomNumbers 生成指定位数的随机数

func ToJsonString

func ToJsonString(v interface{}) string

ToJsonString 将给定结构体转换 json 字符串

func ToJsonStringGB2312

func ToJsonStringGB2312(v interface{}) string

Types

type Fn

type Fn func() error

Fn 定义函数类型

type ITicker

type ITicker struct {
	ITick  *time.Ticker
	Runner Fn
}

ITicker 定时器中的成员

func NewITick

func NewITick(interval time.Duration, f Fn) *ITicker

func (*ITicker) Start

func (t *ITicker) Start()

Start 启动定时器需要执行的任务

func (*ITicker) Stop

func (t *ITicker) Stop()

Stop 停止定时器

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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