util

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSecretTooShort = errors.New("secret is too short, length must be 16/24/32")
	ErrCipherTooShort = errors.New("ciphertext is too short")
)

Functions

func AesDecrypt

func AesDecrypt(cipherText, secret string) (string, error)

func AesEncrypt

func AesEncrypt(plaintext, secret string) (string, error)

func Int64Left

func Int64Left(value int64, length int, pad string) string

Left left-pads the int64 with pad up to len runes

func IntLeft

func IntLeft(value int, length int, pad string) string

func Left

func Left(str string, length int, pad string) string

Left left-pads the string with pad up to len runes len may be exceeded if

func Right(str string, length int, pad string) string

Right right-pads the string with pad up to len runes

Types

type Clock

type Clock interface {
	Now() time.Time
}

type TimeUtil

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

func ConvertWIthTimeZone

func ConvertWIthTimeZone(t time.Time, tzStr string) (TimeUtil, error)

func NewTimeUtil

func NewTimeUtil() TimeUtil

func NewTimeUtilWithTime

func NewTimeUtilWithTime(t time.Time) TimeUtil

func (*TimeUtil) GetTimeStampByLayout

func (t *TimeUtil) GetTimeStampByLayout(timeStr, layout string) (int64, error)

func (TimeUtil) Now

func (t TimeUtil) Now() time.Time

func (*TimeUtil) ToDayString

func (t *TimeUtil) ToDayString() string

func (*TimeUtil) ToMonthString

func (t *TimeUtil) ToMonthString() string

func (*TimeUtil) ToUtcTime

func (t *TimeUtil) ToUtcTime(timestamp int64) time.Time

func (*TimeUtil) ToWeekString

func (t *TimeUtil) ToWeekString() string

func (*TimeUtil) ToYearDayString

func (t *TimeUtil) ToYearDayString() string

func (*TimeUtil) ToYearString

func (t *TimeUtil) ToYearString() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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