utils

package
v1.11.11 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDir added in v1.0.1

func CopyDir(src string, dst string) error

CopyDir 递归复制整个目录

func CopyFile added in v1.0.1

func CopyFile(src, dst string) error

CopyFile 单个文件复制到目标

func FileWrite added in v1.0.1

func FileWrite(filePath string, writeContent []byte) error

FileWrite 文件如果不存在那么创建,存在那么写入

func GetMapKeys added in v1.0.5

func GetMapKeys(oldMap map[string]string) []string

GetMapKeys 获取Map key所有值

func GetMapValues added in v1.0.5

func GetMapValues(oldMap map[string]string) []string

GetMapValues 获取Map val所有值

func GetUserRealIP

func GetUserRealIP(r *http.Request) string

GetUserRealIP 获取用户真实IP

func MapBuildQuery added in v1.0.5

func MapBuildQuery(data map[string]interface{}) string

MapBuildQuery map转请求参数

func PasswordEncrypt added in v1.0.6

func PasswordEncrypt(password string) string

PasswordEncrypt 密码加密

func PathExists added in v1.0.1

func PathExists(path string) bool

PathExists 判断路径是否存在

func PathIsDir added in v1.0.1

func PathIsDir(path string) bool

PathIsDir 判断路径是否为文件夹

func PathIsFile added in v1.0.1

func PathIsFile(path string) bool

PathIsFile 判断路径是否为文件

func PathMkdirAll added in v1.0.1

func PathMkdirAll(filePath string)

PathMkdirAll 递归创建文件夹

func SliceInt64IndexOf

func SliceInt64IndexOf(seq int64, slice []int64) int

SliceInt64IndexOf 数组中是否包含整数

func SliceStringIndexOf

func SliceStringIndexOf(seq string, slice []string) int

SliceStringIndexOf 数组中是否包含字符串

Types

type Broadcast added in v1.11.8

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

Broadcast 广播

func NewBroadcast added in v1.11.8

func NewBroadcast() *Broadcast

NewBroadcast 创建广播

func (*Broadcast) Listener added in v1.11.8

func (c *Broadcast) Listener(chIndex int64) chan *Message

Listener 新增监听者

func (*Broadcast) RemoveListener added in v1.11.8

func (c *Broadcast) RemoveListener(chIndex int64, ch chan *Message)

RemoveListener 移除监听者

func (*Broadcast) Send added in v1.11.8

func (c *Broadcast) Send(msg *Message)

Send 广播消息

func (*Broadcast) Start added in v1.11.8

func (c *Broadcast) Start() chan *Message

Start 启动广播

type Encryption added in v1.11.3

type Encryption struct {
}

func NewEncryption added in v1.11.3

func NewEncryption() *Encryption

func (*Encryption) DesDecrypt added in v1.11.3

func (_Encryption *Encryption) DesDecrypt(data string, key []byte) ([]byte, error)

DesDecrypt des解密

func (*Encryption) DesEncrypt added in v1.11.3

func (_Encryption *Encryption) DesEncrypt(origData, key []byte) (string, error)

DesEncrypt desc 加密

func (*Encryption) PKCS5Padding added in v1.11.3

func (_Encryption *Encryption) PKCS5Padding(cipherText []byte, blockSize int) []byte

PKCS5Padding 填充方式PKCS5Padding

func (*Encryption) PKCS5UnPadding added in v1.11.3

func (_Encryption *Encryption) PKCS5UnPadding(origData []byte) []byte

PKCS5UnPadding 对应 PKCS5Padding

type Message added in v1.11.8

type Message struct {
	Type string
	Data interface{}
}

Message 广播消息

type Random added in v1.0.1

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

Random 随机

func NewRandom added in v1.0.1

func NewRandom() *Random

NewRandom 随机数

func (*Random) OrderSn added in v1.0.1

func (c *Random) OrderSn() string

OrderSn 随机生成订单号

func (*Random) SetLetterRunes added in v1.0.1

func (c *Random) SetLetterRunes() *Random

SetLetterRunes 设置字母基数

func (*Random) SetNumberRunes added in v1.0.1

func (c *Random) SetNumberRunes() *Random

SetNumberRunes 设置数字基数

func (*Random) String added in v1.0.1

func (c *Random) String(n int) string

String 随机字符串

Jump to

Keyboard shortcuts

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