util

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Diff = diff.Diff
View Source
var ErrorTokenExpired = fmt.Errorf("Token expired")
View Source
var ErrorTokenInvalid = fmt.Errorf("Token invalid")

Functions

func CalcExpiry

func CalcExpiry(days int) string

func CheckToken

func CheckToken(secret, expiry, input, token string) error

func DaysBetween

func DaysBetween(start, end time.Time) []time.Time

func DiffOnly

func DiffOnly(one, two string) string

func FirstChar

func FirstChar(input string) string

func FirstFiveChars

func FirstFiveChars(input string) string

func FirstNonEmptyString

func FirstNonEmptyString(inputs ...string) string

func GetTxCtx

func GetTxCtx(db *sql.DB) (context.Context, *sql.Tx, error)

func Hash

func Hash(str string) string

func HashPassword

func HashPassword(rawpassword string) (string, error)

func IsBetween

func IsBetween(target, start, end time.Time) bool

func IsWeekday

func IsWeekday(day time.Time) bool

func IsWeekend

func IsWeekend(day time.Time) bool

func NextDay

func NextDay(begin time.Time, target time.Weekday) time.Time

func Parallelize

func Parallelize(functions ...func() error) (errors []error)

func Prefix

func Prefix(strs []string, prefix string) []string

func PrettyJsonString

func PrettyJsonString(input string) string

func RollbackTx

func RollbackTx(ctx context.Context) error

func StripBlankStrings

func StripBlankStrings(input []string) []string

func Uniq

func Uniq(input []string) []string

Types

type ClientSafeError

type ClientSafeError struct {
	Message string
}

func (ClientSafeError) ClientSafeMessage

func (err ClientSafeError) ClientSafeMessage() string

func (ClientSafeError) Error

func (err ClientSafeError) Error() string

type IntMap

type IntMap map[string]int

func (*IntMap) Scan

func (p *IntMap) Scan(src interface{}) error

func (IntMap) Value

func (p IntMap) Value() (driver.Value, error)

type Period

type Period struct {
	Start time.Time
	End   time.Time
}

func (Period) Next

func (this Period) Next() Period

func (Period) Prev

func (this Period) Prev() Period

type StringMap

type StringMap map[string]string

func (*StringMap) Scan

func (p *StringMap) Scan(src interface{}) error

func (StringMap) Value

func (p StringMap) Value() (driver.Value, error)

type Token

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

func CalcToken

func CalcToken(secret string, days int, input string) Token

func (Token) ExpiryString

func (this Token) ExpiryString() string

func (Token) String

func (this Token) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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