util

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeginningOfDay

func BeginningOfDay(t time.Time) time.Time

BeginningOfDay 获取t日起始

func BeginningOfMonth

func BeginningOfMonth(t time.Time) time.Time

BeginningOfMonth 获取t月第一天

func Caller

func Caller(skip int) (file string, line int, function string)

Caller 返回调用方的代码路径,行号,方法名

func DiffDays

func DiffDays(t1 time.Time, t2 time.Time) int

DiffDays 计算t1,t2之间的天差

func EndOfDay

func EndOfDay(t time.Time) time.Time

EndOfDay 获取t日结束

func EndOfMonth

func EndOfMonth(t time.Time) time.Time

EndOfMonth 获取t月最后一天

func F322d

func F322d(m float32) float32

func LatitudePan

func LatitudePan(latitude float32, meter int) float32

LatitudePan 计算纬度偏移meter米后的纬度

func LongitudePan

func LongitudePan(longtitude float32, meter int) float32

LongitudePan 计算经度偏移meter米后的经度

func MaskMobile

func MaskMobile(mobile string) string

func RandLetters

func RandLetters(length int) string

RandLetters 生成随机字母串

func RandNumbers

func RandNumbers(length int) string

RandNumbers 生成随机数字串

func Tpl

func Tpl(template string, param TplParam) string

Tpl ��格式化文本 "Hello, {{name}}" {"name":"simon"} => Hello, simon

func UintContains

func UintContains(arr []uint, find uint) bool

func WrapCaller

func WrapCaller(file string, line int, fn string) string

Types

type Map

type Map map[string]interface{}

type SimpleAES

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

SimpleAES 包装aes,使得使用更简单点

func NewSimpleAES

func NewSimpleAES(key []byte) (*SimpleAES, error)

NewSimpleAES 构造SimpleAES

func (*SimpleAES) Dec

func (s *SimpleAES) Dec(data string) ([]byte, error)

Dec 解密data,返回当初传入Enc的数据

func (*SimpleAES) Enc

func (s *SimpleAES) Enc(data []byte) (string, error)

Enc 加密data,返回的string包含nonce和加密后的data

type TplParam

type TplParam map[string]interface{}

TplParam 便于书写map

Jump to

Keyboard shortcuts

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