helper

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: MIT Imports: 22 Imported by: 0

README

go-helper

go helper

Documentation

Overview

基于redis

Index

Constants

This section is empty.

Variables

Functions

func FileMd5

func FileMd5(url string) string

FileMd5 获取文件的md5值

func GenRSA

func GenRSA(bits int, outputPath string) error

GenRSA 生成RSA公钥私钥证书 bits 秘钥长度 outputPath 证书保存路径

func HttpsExpireTimestamp

func HttpsExpireTimestamp(URL string) (timestamp int64, err error)

HttpsExpireTimestamp https证书过期时间

func Md5

func Md5(str string) string

Md5 字符串md5

func NewMailer

func NewMailer(host string, port int, username string, password string) mailer

NewMailer

func NewTree

func NewTree(IDField string, PIDField string) *tree

New IDField 节点id字段 PIDField 父节点字段

func PrintError

func PrintError(msg interface{}, detail ...interface{})

PrintError 打印错误 带行号及颜色

func PrintInfo

func PrintInfo(msg interface{}, detail ...interface{})

PrintInfo 打印信息 带行号及颜色

func PrintPanic

func PrintPanic(msg interface{}, detail ...interface{})

PrintPanic 打印错误 带行号及颜色

func PrintSuccess

func PrintSuccess(msg interface{}, detail ...interface{})

PrintSuccess 打印信息 带行号及颜色

func PrintWarning

func PrintWarning(msg interface{}, detail ...interface{})

PrintWarning 打印信息 带行号及颜色

func RandString

func RandString(len int) string

RandString 生成随机字符串

Types

type Datetime

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

func (*Datetime) ToDate

func (dt *Datetime) ToDate(format string) string

ToDate 时间日期格式化显示 format 格式化 Y-m-d H:i:s time 时间戳,0为当前时间戳 timezone 时区,nil为系统默认时区

func (*Datetime) ToTime

func (dt *Datetime) ToTime(value string) (timestamp int64, err error)

ToTime 时间转为时间戳

func (*Datetime) WithTimestamp

func (dt *Datetime) WithTimestamp(timestamp int64) *Datetime

WithTimestamp 待转换的时间戳

func (*Datetime) WithTimezone

func (dt *Datetime) WithTimezone(timezone int) *Datetime

WithTimezone 相对时区

type Print

type Print struct {
	Skip int
}

Print 定义打印 Skip 默认为1,即调用Print方法的地方 其值代表堆栈向上提升的层级

func (Print) Print

func (p Print) Print(msg interface{}, printType string, detail ...interface{})

Print 打印内容 print_type, error or info

type UUID

type UUID struct{}

唯一键

func (UUID) Init

func (uuid UUID) Init(conf redisx.Config)

Init redis初始化连接池

func (UUID) Int64 added in v0.0.2

func (uuid UUID) Int64() (ID int64, err error)

func (UUID) String added in v0.0.2

func (uuid UUID) String() (ID string, err error)

Jump to

Keyboard shortcuts

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