utils

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2021 License: MIT Imports: 16 Imported by: 1

README

go-cryptolib

一些常见加密算法封装

包括:

  • Hash - SHA1/SHA2/MD5/CSC32
  • 对称加密 - AES
  • 非对称加密 - RSA256/RSA512
  • 签名 - RSA-SHA1/RSA-SHA256/RSA-SHA512/ECC-ED25519

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64Decode

func Base64Decode(value string) (string, error)

Base64Decode Base64Decode

func Common

func Common()

Common Common

func DeepCopy

func DeepCopy(dst, src interface{}) error

DeepCopy DeepCopy

func DeepCopyByJSON

func DeepCopyByJSON(dst, src interface{}) error

DeepCopyByJSON DeepCopyByJSON

func DefaultString

func DefaultString(value, defaultValue string) string

DefaultString DefaultString

func GenCustomTimestamp

func GenCustomTimestamp() string

GenCustomTimestamp GenCustomTimestamp

func GenRandomNumString

func GenRandomNumString(l int) string

GenRandomNumString GenRandomNumString

func GenRandomSixDigital

func GenRandomSixDigital() string

GenRandomSixDigital GenRandomSixDigital

func GenRandomString

func GenRandomString(l int) string

GenRandomString GenRandomString

func IsDigitPresent

func IsDigitPresent(number, d int) bool

IsDigitPresent IsDigitPresent

func IsDigitPresentUint64

func IsDigitPresentUint64(number uint64, d uint64) bool

IsDigitPresentUint64 IsDigitPresentUint64

func LocalCurrent

func LocalCurrent() time.Time

LocalCurrent LocalCurrent

func NewDateFromString

func NewDateFromString(value, layout string) (time.Time, error)

NewDateFromString NewDateFromString layout 2006-01-02

func NewDateFromYearMonthDay

func NewDateFromYearMonthDay(year, month, day string) (time.Time, error)

NewDateFromYearMonthDay NewDateFromYearMonthDay

func NewDateUtc8FromYearMonthDay

func NewDateUtc8FromYearMonthDay(year, month, day string) (time.Time, error)

NewDateUtc8FromYearMonthDay NewUtc8DateFromYearMonthDay

func OrderBizIDGen

func OrderBizIDGen() string

OrderBizIDGen BIZIDGen 201907301746-544-0298

func OrderOriIDRestore

func OrderOriIDRestore(bizid string) string

OrderOriIDRestore OrderOriIDRestore order-2019080812282674502

func OrderShortBizIDGen

func OrderShortBizIDGen() string

OrderShortBizIDGen BIZIDGen 1907301746-54-029

func OrderShortBizIDGenUint64

func OrderShortBizIDGenUint64() uint64

OrderShortBizIDGenUint64 OrderShortBizIDGenUint64

func ParseBytesToInt

func ParseBytesToInt(b []byte) int

ParseBytesToInt 字节转换成整形

func ParseBytesToInt32

func ParseBytesToInt32(b []byte) int32

ParseBytesToInt32 字节转换成整形

func ParseBytesToInt64

func ParseBytesToInt64(b []byte) int64

ParseBytesToInt64 字节转换成整形

func ParseBytesToUint

func ParseBytesToUint(b []byte) uint

ParseBytesToUint 字节转换成整形

func ParseBytesToUint32

func ParseBytesToUint32(b []byte) uint32

ParseBytesToUint32 字节转换成整形

func ParseBytesToUint64

func ParseBytesToUint64(b []byte) uint64

ParseBytesToUint64 字节转换成整形

func ParseInt32ToBytes

func ParseInt32ToBytes(num int32) []byte

ParseInt32ToBytes 整形转换成字节

func ParseInt32ToStr

func ParseInt32ToStr(value int32) string

ParseInt32ToStr ParseInt32ToStr

func ParseInt64ToBytes

func ParseInt64ToBytes(num int64) []byte

ParseInt64ToBytes 整形转换成字节

func ParseInt64ToStr

func ParseInt64ToStr(value int64) string

ParseInt64ToStr ParseInt64ToStr

func ParseIntToBytes

func ParseIntToBytes(num int) []byte

ParseIntToBytes 整形转换成字节

func ParseIntToStr

func ParseIntToStr(value int) string

ParseIntToStr ParseIntToStr

func ParseStrToInt

func ParseStrToInt(value string, defaultValue int) int

ParseStrToInt ParseInt

func ParseStrToInt32

func ParseStrToInt32(value string, defaultValue int32) int32

ParseStrToInt32 ParseStrToInt32

func ParseStrToInt64

func ParseStrToInt64(value string, defaultValue int64) int64

ParseStrToInt64 ParseInt64

func ParseStrToUint

func ParseStrToUint(value string, defaultValue uint) uint

ParseStrToUint ParseUint

func ParseStrToUint32

func ParseStrToUint32(value string, defaultValue uint32) uint32

ParseStrToUint32 ParseUint

func ParseStrToUint64

func ParseStrToUint64(value string, defaultValue uint64) uint64

ParseStrToUint64 ParseUint64

func ParseTimeNano

func ParseTimeNano(value string, defaultValue time.Time) time.Time

ParseTimeNano ParseTimeNano

func ParseUint32ToBytes

func ParseUint32ToBytes(num uint32) []byte

ParseUint32ToBytes 整形转换成字节

func ParseUint32ToStr

func ParseUint32ToStr(value uint32) string

ParseUint32ToStr ParseUint32ToStr

func ParseUint64ToBytes

func ParseUint64ToBytes(num uint64) []byte

ParseUint64ToBytes 整形转换成字节

func ParseUint64ToStr

func ParseUint64ToStr(value uint64) string

ParseUint64ToStr ParseUint64ToStr

func ParseUintToBytes

func ParseUintToBytes(num uint) []byte

ParseUintToBytes 整形转换成字节

func ParseUintToStr

func ParseUintToStr(value uint) string

ParseUintToStr ParseUintToStr

func SplitPhone

func SplitPhone(phone string) (string, string, apperr.Error)

SplitPhone SplitPhone +8615618297195",

func Time0

func Time0(time1 time.Time) time.Time

Time0 取任一时间对应的 0 点

func TimeFormatDate

func TimeFormatDate(tm time.Time) string

TimeFormatDate 截断日期输出

func TimeFormatDateTime

func TimeFormatDateTime(tm time.Time) string

TimeFormatDateTime 截断日期输出

func TimeFormatWithLayout

func TimeFormatWithLayout(tm time.Time, layout string) string

TimeFormatWithLayout TimeFormatWithLayout

func UUIDGenFromString

func UUIDGenFromString(value string) uuid.UUID

UUIDGenFromString 使用字符串生成固定的 UUID

func UUIDHexGenFromString

func UUIDHexGenFromString(value string) string

UUIDHexGenFromString 使用字符串生成固定的 UUID

func UUIDParseFromString

func UUIDParseFromString(value string) (uuid.UUID, error)

UUIDParseFromString UUIDParseFromString

func UUIDStringGen

func UUIDStringGen() string

UUIDStringGen UUIDStringGen b9be9a09-7117-4bdb-9c6d-737269c86480

func UUIDStringGenFromString

func UUIDStringGenFromString(value string) string

UUIDStringGenFromString 使用字符串生成固定的 UUID

func UUIDV1HexGen

func UUIDV1HexGen() string

UUIDV1HexGen UUIDV1HexGen 5106b5e58ee44f74a5d49e779dcf7f57

func UUIDV1StringGen

func UUIDV1StringGen() string

UUIDV1StringGen UUIDV1StringGen b9be9a09-7117-4bdb-9c6d-737269c86480

func UUIDV4HexGen

func UUIDV4HexGen() string

UUIDV4HexGen UUIDV4HexGen 5106b5e58ee44f74a5d49e779dcf7f57

func UUIDV4StringGen

func UUIDV4StringGen() string

UUIDV4StringGen UUIDV4StringGen b9be9a09-7117-4bdb-9c6d-737269c86480

func Utc0Current

func Utc0Current() time.Time

Utc0Current 取当前时间的 UTC0

func Utc0Time

func Utc0Time(tm time.Time) time.Time

Utc0Time 取时间的 UTC0

func Utc8Current

func Utc8Current() time.Time

Utc8Current 取当前时间的 UTC8

func Utc8Day

func Utc8Day(days int) time.Time

Utc8Day 当前服务器时间的东八区指定天数日期 服务器时区不重要,统一换算为东八区 再向前取一天

func Utc8Day0

func Utc8Day0(time1 time.Time) time.Time

Utc8Day0 把任一时间,换算成东八区0点

func Utc8DayString

func Utc8DayString(days int) string

Utc8DayString 当前服务器时间的东八区昨天日期 服务器时区不重要,统一换算为东八区 再向前取一天

func Utc8DuctionDays

func Utc8DuctionDays(time1, time2 time.Time) int

Utc8DuctionDays 一个日期和另一个日期相差多少天 要都在东八区算 两边都要先算成 0点,因为两边都算整天的

func Utc8Lastday

func Utc8Lastday() time.Time

Utc8Lastday 当前服务器时间的东八区昨天日期 服务器时区不重要,统一换算为东八区 再向前取一天

func Utc8LastdayString

func Utc8LastdayString() string

Utc8LastdayString 当前服务器时间的东八区昨天日期 服务器时区不重要,统一换算为东八区 再向前取一天

func Utc8Time

func Utc8Time(tm time.Time) time.Time

Utc8Time 取时间的 UTC8

func Utc8Today

func Utc8Today() time.Time

Utc8Today 东八区今天日期

func Utc8TodayString

func Utc8TodayString() string

Utc8TodayString 东八区今天日期

Types

This section is empty.

Directories

Path Synopsis
aes
rsa

Jump to

Keyboard shortcuts

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