goo_utils

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: Apache-2.0 Imports: 34 Imported by: 5

Documentation

Index

Constants

View Source
const (
	EL = "\n"
)

Variables

View Source
var (
	ErrInitialize = errors.New("not yet initialized")
)

Functions

func AESCBCDecrypt

func AESCBCDecrypt(cipherData, key, iv []byte) ([]byte, error)

func AESCBCEncrypt

func AESCBCEncrypt(rawData, key, iv []byte) ([]byte, error)

func AESECBDecrypt

func AESECBDecrypt(buf, key []byte) ([]byte, error)

func AESECBEncrypt

func AESECBEncrypt(data, key []byte) ([]byte, error)

func AsyncFunc

func AsyncFunc(fn func())

func Base64Decode

func Base64Decode(str string) []byte

func Base64Encode

func Base64Encode(buf []byte) string

func BigIntAdd

func BigIntAdd(num1 string, num2 string) string

func BigIntCmp

func BigIntCmp(num1 string, num2 string) int

比大小,大于返回1,等于返回0,小于返回-1

func BigIntDiv

func BigIntDiv(num1 string, num2 string) string

func BigIntMod

func BigIntMod(num1 string, num2 string) string

取模

func BigIntMul

func BigIntMul(num1 string, num2 string) string

func BigIntReduce

func BigIntReduce(num1 string, num2 string) string

func CaptchaGet

func CaptchaGet(width, height int) map[string]string

获取图片验证码

func CaptchaVerify

func CaptchaVerify(id, code string) bool

验证图片验证码

func Code2Id

func Code2Id(code string) (int64, error)

func DIR

func DIR() string

func Date2Ts

func Date2Ts(date string) int64

func DateTime2Ts

func DateTime2Ts(dateTime string) int64

func FILE

func FILE() string

func GBK2UTF8

func GBK2UTF8(s string) string

func HMacMd5

func HMacMd5(buf, key []byte) string

func HMacSha1

func HMacSha1(buf, key []byte) string

func HMacSha256

func HMacSha256(buf, key []byte) string

func Id2Code

func Id2Code(id int64) string

func LINE

func LINE() int

func MD5

func MD5(buf []byte) string

func NewIdCode

func NewIdCode(key string) *idCode

func NextDate

func NextDate(d int) string

func NonceStr

func NonceStr() string

func PinYin

func PinYin(origin string) (string, error)

func Recover

func Recover()

func SHA1

func SHA1(buf []byte) string

func SHA256

func SHA256(buf, key []byte) string

func SHAWithRSA

func SHAWithRSA(key, data []byte) (string, error)

func SessionId

func SessionId() string

func Today

func Today() string

func Trace

func Trace(skip int) []string

func Ts2Date

func Ts2Date(ts int64) string

func Ts2DateTime

func Ts2DateTime(ts int64) string

func UTF82GBK

func UTF82GBK(s string) string

func WriteToFile

func WriteToFile(filename, content string) error

Types

type Byte

type Byte []byte

func (Byte) Params

func (b Byte) Params() (Params, error)

type Mode

type Mode int
const (
	WithoutTone        Mode = iota + 1 // 默认模式,例如:guo
	Tone                               // 带声调的拼音 例如:guó
	InitialsInCapitals                 // 首字母大写不带声调,例如:Guo
)

type Params

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

func (Params) Array

func (p Params) Array() (ps []Params)

func (Params) Bool

func (p Params) Bool() bool

func (Params) Data

func (p Params) Data() map[string]interface{}

func (Params) Float32

func (p Params) Float32() float32

func (Params) Float64

func (p Params) Float64() float64

func (Params) Get

func (p Params) Get(key string) Params

func (Params) Int

func (p Params) Int() int

func (Params) Int64

func (p Params) Int64() int64

func (Params) JSON

func (p Params) JSON() []byte

func (Params) Map

func (p Params) Map() (rst map[string]Params)

func (Params) Set

func (p Params) Set(key string, val interface{}) Params

func (Params) String

func (p Params) String() string

type StringMap

type StringMap map[string]string

func (StringMap) MarshalXML

func (m StringMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*StringMap) UnmarshalXML

func (m *StringMap) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

Jump to

Keyboard shortcuts

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