util

package
v0.0.0-...-46283b3 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

* @Description: gomall * @Author: ylf * @Date: 2024-10-17 17:18:20 * @LastEditTime: 2025-06-28 09:30:36 * @LastEditors: ylf * @FilePath: \ltool\pkg\util\string.go

Index

Constants

View Source
const (
	TimeLayout   = "2006-01-02 15:04:05"
	TimeLayout_2 = "20060102150405"
	DateLayout   = "2006-01-02"
	NULL         = ""
)

Variables

This section is empty.

Functions

func BinaryToDecimal

func BinaryToDecimal(bit string) (num int)

二进制转10进制

func BytesToString

func BytesToString(b []byte) (s string)

BytesToString 0 拷贝转换 slice byte 为 string

func ConvertToString

func ConvertToString(v interface{}) (str string)

func Float32ToString

func Float32ToString(floatNum float32, prec ...int) (floatStr string)

Float32转字符串

floatNum:float32数字
prec:精度位数(不传则默认float数字精度)

func Float64ToString

func Float64ToString(floatNum float64, prec ...int) (floatStr string)

Float64转字符串

floatNum:float64数字
prec:精度位数(不传则默认float数字精度)

func F获取缓存token

func F获取缓存token(ii I缓存token接口) (tk string, err error)

func GetRandomNumber

func GetRandomNumber(l int) string

随机生成数字字符串

func GetRandomPureString

func GetRandomPureString(l int) string

随机生成纯字符串

func GetRandomString

func GetRandomString(l int) string

随机生成字符串

func Int2String

func Int2String(intNum int) (intStr string)

Int转字符串

intNum:数字字符串

func Int642String

func Int642String(intNum int64) (int64Str string)

Int64转字符串

intNum:数字字符串

func String2Float32

func String2Float32(floatStr string) (floatNum float32)

字符串转Float32

floatStr:小数点数字的字符串

func String2Float64

func String2Float64(floatStr string) (floatNum float64)

字符串转Float64

floatStr:小数点数字的字符串

func String2Int

func String2Int(intStr string) (intNum int)

字符串转Int

intStr:数字的字符串

func String2Int64

func String2Int64(intStr string) (int64Num int64)

字符串转Int64

intStr:数字的字符串

Types

type File

type File struct {
	Name    string `json:"name"`
	Content []byte `json:"content"`
}

type I缓存token接口

type I缓存token接口 interface {
	F获取token() (token string, exp int64, err error)
	F获取Tk与过期时间和锁() (string, int64, *sync.RWMutex)
}

Jump to

Keyboard shortcuts

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