str

package
v0.0.0-...-e317c74 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Area *area

Functions

This section is empty.

Types

type ByteTool

type ByteTool struct {
	// contains filtered or unexported fields
}

ByteTool 字节流工具

func NewByteTool

func NewByteTool(reader io.Reader) *ByteTool

NewByteTool 实例化工具类

func (*ByteTool) Md5

func (s *ByteTool) Md5() (string, error)

Md5 获取md5

type DateTime

type DateTime time.Time

DateTime 自定义日期时间类型,适配JSON和数据库操作

func (*DateTime) MarshalJSON

func (t *DateTime) MarshalJSON() ([]byte, error)

MarshalJSON 实现JSON序列化接口

func (*DateTime) Scan

func (t *DateTime) Scan(v interface{}) error

Scan 实现数据库读取接口(保持指针接收器,需要修改接收者)

func (*DateTime) String

func (t *DateTime) String() string

String 实现字符串输出

func (*DateTime) UnmarshalJSON

func (t *DateTime) UnmarshalJSON(data []byte) error

UnmarshalJSON 实现JSON反序列化接口

func (DateTime) Value

func (t DateTime) Value() (driver.Value, error)

Value 实现数据库写入接口(关键优化:值接收器)

type JsonTool

type JsonTool struct {
	// contains filtered or unexported fields
}

JsonTool json工具

func NewJsonTool

func NewJsonTool(data interface{}) *JsonTool

NewJsonTool 实例化工具类

func (*JsonTool) ToString

func (j *JsonTool) ToString() string

ToString 转json字符串

type NickTool

type NickTool struct {
	// contains filtered or unexported fields
}

NickTool 网名生成工具

func NewNickTool

func NewNickTool() *NickTool

NewNickTool 实例化(带随机种子,避免每次生成一样)

func (*NickTool) GetRand

func (n *NickTool) GetRand() string

GetRand 生成自然好看的随机网名(主方法)

type StringTool

type StringTool struct {
	// contains filtered or unexported fields
}

StringTool 字符串工具

func NewStrTool

func NewStrTool() *StringTool

NewStrTool 实例化工具类

func NewStringTool

func NewStringTool(str string) *StringTool

NewStringTool 实例化工具类

func (*StringTool) AesCbcDecrypt

func (stringTool *StringTool) AesCbcDecrypt(key string) string

AesCbcDecrypt aes cbc解密

func (*StringTool) AesCbcEncrypt

func (stringTool *StringTool) AesCbcEncrypt(key string) string

AesCbcEncrypt aes cbc加密

func (*StringTool) AesDecrypt

func (stringTool *StringTool) AesDecrypt(key string) string

func (*StringTool) AesEncrypt

func (stringTool *StringTool) AesEncrypt(key string) string

func (*StringTool) CheckPassword

func (stringTool *StringTool) CheckPassword(password string) bool

CheckPassword 比对密码

func (*StringTool) ConvertToString

func (stringTool *StringTool) ConvertToString(srcCode string, tagCode string) string

ConvertToString 编码转换

func (*StringTool) GenValidateCode

func (stringTool *StringTool) GenValidateCode(width int) string

GenValidateCode 生成指定位数验证码

func (*StringTool) GetBetween

func (stringTool *StringTool) GetBetween(start string, end string) string

GetBetween 获取文本中间字符

func (*StringTool) GetPassword

func (stringTool *StringTool) GetPassword() string

GetPassword 获取密码

func (*StringTool) Md5

func (stringTool *StringTool) Md5(short ...bool) string

Md5 获取字符串md5值 Md5 获取字符串MD5值 默认:返回 32位 标准MD5 传参 true:返回 16位 短MD5

func (*StringTool) RandInt64

func (stringTool *StringTool) RandInt64(min, max int64) int64

func (*StringTool) Show

func (stringTool *StringTool) Show(left int, right int, str string) string

Show 显示首尾数据字符个数

func (*StringTool) ToDevice

func (stringTool *StringTool) ToDevice() (name string, dtype string)

ToDevice 解析User-Agent,返回设备型号和大类

func (*StringTool) ToMap

func (stringTool *StringTool) ToMap() map[string]string

ToMap 转map

type TimeTool

type TimeTool struct {
}

TimeTool 时间工具

func NewTimeTool

func NewTimeTool() *TimeTool

NewTimeTool 实例化工具类

func (*TimeTool) GetFirstDateOfMonth

func (t *TimeTool) GetFirstDateOfMonth(d time.Time) time.Time

GetFirstDateOfMonth 获取某月第一天

func (*TimeTool) GetLastDateOfMonth

func (t *TimeTool) GetLastDateOfMonth(d time.Time) time.Time

GetLastDateOfMonth 获取传入的时间所在月份的最后一天,即某月最后一天的0点。如传入time.Now(), 返回当前月份的最后一天0点时间。

func (*TimeTool) GetZeroTime

func (*TimeTool) GetZeroTime(d time.Time) time.Time

GetZeroTime 获取某一天的0点时间

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

Worker 定义一个worker工作节点所需要的基本参数

func GetSnowWorkIns

func GetSnowWorkIns() *Worker

GetSnowWorkIns 获取静态对象

func NewSnowWorker

func NewSnowWorker(workerId int64) (*Worker, error)

NewSnowWorker 实例化一个工作节点

func (*Worker) GetId

func (w *Worker) GetId() int64

GetId 获取唯一id

func (*Worker) GetUuid

func (w *Worker) GetUuid() string

GetUuid 获取uuid

Jump to

Keyboard shortcuts

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