dongo_utils

package module
v0.0.0-...-beb8aba Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

README

dongo_utils

自用golang工具包 dongo_utils

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PariMap = make(map[string]interface{})

键值对

Functions

func CheckExist

func CheckExist(path string) bool

判断文件或文件夹是否存在

func Chk

func Chk(err error)

捕获异常 error

func CopyFile

func CopyFile(source, target string) bool

复制文件

func CreateImg

func CreateImg(fileAddress1, fileAddress2, createAddress string) error

创建图片

func CreateQrCode

func CreateQrCode(fileName, content string)

创建二维码

func DelFile

func DelFile(s string)

删除无用文件

func Delete

func Delete(key string)

func DuplicateIntArray

func DuplicateIntArray(m []int) []int

数组去重

func DuplicateInterface

func DuplicateInterface(data []interface{}) []interface{}

interface 去重

func DuplicateStringArray

func DuplicateStringArray(m []string) []string

字符串数组去重

func ExistIntArray

func ExistIntArray(s []int, e int) bool

数组存在某个数字

func ExistInterface

func ExistInterface(s []interface{}, e interface{}) bool

interface 存在

func ExistStringArray

func ExistStringArray(s []string, e string) bool

字符串数组存在某个字符串

func GenerateCode

func GenerateCode() string

生成订单号 日期20191025时间戳1571987125435+3位随机数

func Get

func Get(key string) interface{}

func GetCurrentDir

func GetCurrentDir() string

获取当前文件夹路径

func GetDifferentIntArray

func GetDifferentIntArray(sourceList, sourceList2 []int) (result []int)

数组取出不同元素 放入结果 sourceList中的元素不在sourceList2中 则取到result中

func GetDifferentStringArray

func GetDifferentStringArray(sourceList, sourceList2 []string) (result []string)

数组取出不同元素 放入结果 sourceList中的元素不在sourceList2中 则取到result中

func GetHmacSha256Str

func GetHmacSha256Str(s string, key string) string

func GetMd5Str

func GetMd5Str(salt string) func(string) string

func GetParentDir

func GetParentDir(dirctory string) string

获取上一级文件夹路径

func GetSha1Str

func GetSha1Str(salt string) func(string) string

func GetSha256Str

func GetSha256Str(salt string) func(string) string

func Int64ConvertToTime

func Int64ConvertToTime(intTime int64) time.Time

int64 to time

func LoadQrCode

func LoadQrCode(fileName, content string)

加载二维码

func Lottery

func Lottery(a int) string

抽奖

func Md5

func Md5(b []byte) []byte

md5

func MergeDuplicateIntArray

func MergeDuplicateIntArray(slice []int, elems []int) []int

合并两个数组并去重

func MergeDuplicateStringArray

func MergeDuplicateStringArray(slice []string, elems []string) []string

合并两个字符串数组并去重

func Panic

func Panic(p interface{}) (err error)

捕获/恢复panic

func ParisMap_Del

func ParisMap_Del(key string)

func ParisMap_DelAll

func ParisMap_DelAll()

func ParisMap_Get

func ParisMap_Get(key string) interface{}

func ParisMap_Put

func ParisMap_Put(key string, value interface{})

func ParseCurrentMonday

func ParseCurrentMonday(t time.Time) time.Time

获取最近的周一

func ParseFirstDayOfMonthMorning

func ParseFirstDayOfMonthMorning(t time.Time) time.Time

当月第一天0点

func ParseHourTimeToInt64

func ParseHourTimeToInt64() int64

获取int64 小时

func ParseMorningTime

func ParseMorningTime(t time.Time) time.Time

返回某一天的当地时区0点

func ParseSecondTimeToInt64

func ParseSecondTimeToInt64() int64

获取int64 秒

func ParseTimeByTimeStr

func ParseTimeByTimeStr(str, errPrefix string) (time.Time, error)

时间转换 将1993-12-26 10:30:00转换为time

func ParseTimeToString

func ParseTimeToString(intTime int64, strfmt ...string) string

把int64转换成1993-12-26 10:30:00

func ParseTimeToYearMonthDay

func ParseTimeToYearMonthDay(time time.Time) string

转换时间 年月日

func ParseYesterdayTime

func ParseYesterdayTime(t ...time.Time) time.Time

获取传入时间前一天的时间,不传默认是昨天

func Pause

func Pause()

参考CMD语法 等待用户随机指令关闭程序

func PrintCommand

func PrintCommand(command string)

打印命令

func PrintJson

func PrintJson(any ...interface{})

打印json

func Put

func Put(key, value string)

func RegexpToken

func RegexpToken(token string) (bool, error)

正则表达验证 Token

func SendEmail

func SendEmail(msg *EmailMsg, emailConfig *EmailConfig) error

发送邮件

func Sha1

func Sha1(b []byte) []byte

sha1

func Sha256

func Sha256(b []byte) []byte

sha256

func Tick32

func Tick32(t ...time.Time) int32

获取int32 获取秒

func Tick64

func Tick64(t ...time.Time) int64

获取int64 获取毫秒

func ToJsonString

func ToJsonString(v interface{}) (string, error)

转换json

Types

type EmailConfig

type EmailConfig struct {
	Host     string `json:"host"`
	Port     int    `json:"port"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type EmailMsg

type EmailMsg struct {
	From       []string
	To         []string
	Cc         []string
	Subject    string
	Body       string
	Attachment string
}

type Memory

type Memory struct {
	Name  string       //内存容器名
	Items []MemoryItem //多个项
}

内存容器

func NewMemory

func NewMemory(name string) *Memory

func (*Memory) Delete

func (p *Memory) Delete(newItem interface{}) bool

func (*Memory) Get

func (p *Memory) Get() interface{}

func (*Memory) Length

func (p *Memory) Length() int

func (*Memory) Put

func (p *Memory) Put(newItem interface{}) bool

func (*Memory) Repair

func (p *Memory) Repair(time int64)

type MemoryItem

type MemoryItem struct {
	Ct   int64       //创建时间
	Et   int64       //过期时间
	Item interface{} //扩展变量
}

Jump to

Keyboard shortcuts

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