helper

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TimeLayoutY                 = "2006"
	TimeLayoutYM                = "2006-01"
	TimeLayoutYMD               = "2006-01-02"
	TimeLayoutYMDHM             = "2006-01-02 15:04"
	TimeLayoutYMDHMS            = "2006-01-02 15:04:05"
	TimeLayoutHM                = "15:04"
	TimeLayoutMDYYYYHMMSSPM     = "1/2/2006 3:04:05 PM"
	TimeLayoutNoSepYYYYMMDDHHMM = "200601021504"
	TimeLayoutTextMD            = "January 2"
)
View Source
const Day = 86400
View Source
const Hour = 3600
View Source
const Minute = 60
View Source
const Month = 2592000
View Source
const Second = 1
View Source
const Week = 604800
View Source
const Year = 31104000

Variables

This section is empty.

Functions

func BoolToInt added in v0.0.8

func BoolToInt(b bool) int8

func CSVToMap added in v0.0.8

func CSVToMap(reader *bytes.Buffer) ([]map[string]string, error)

func ChunkSliceUint64 added in v0.0.8

func ChunkSliceUint64(slice []uint64, chunkSize int) [][]uint64

func ConvertUint64ToHex added in v0.0.8

func ConvertUint64ToHex(serialNumber uint64) string

func Copy added in v0.0.8

func Copy(src, dst string, bufferSize int64) error

func DBTransaction added in v0.0.8

func DBTransaction(ormService *orm.Engine, callback transaction) error

func ExistsInDir

func ExistsInDir(filename, dir string) bool

func FileExistsInDir added in v0.0.8

func FileExistsInDir(filename, dir string) bool

func GenerateUUID added in v0.0.8

func GenerateUUID() string

func GetFileExtensionFromBase64Header added in v0.0.8

func GetFileExtensionFromBase64Header(base64Header string) (string, error)

func GetSecondsDifference added in v0.0.8

func GetSecondsDifference(from, to time.Time) float64

func GetTemplateDirectory added in v0.0.8

func GetTemplateDirectory() string

func GetTimeDifferenceHuman added in v0.0.8

func GetTimeDifferenceHuman(startDate, endDate time.Time) string

func GetTimeDifferenceHumanBySeconds added in v0.0.8

func GetTimeDifferenceHumanBySeconds(seconds float64) string

func GetTimestamp added in v0.0.8

func GetTimestamp(t *time.Time) int64

func GetWeekDay added in v0.0.8

func GetWeekDay(dateTime time.Time) uint8

func IsValidEnum added in v0.0.8

func IsValidEnum(val string, enums map[string]string) bool

func Limit added in v0.0.8

func Limit(pager *orm.Pager) string

func SliceUint64Difference added in v0.0.8

func SliceUint64Difference(slice1 []uint64, slice2 []uint64) []uint64

func ValidateAndParseTimeRange added in v0.0.8

func ValidateAndParseTimeRange(startsAt, endsAt, fromName, toName string, startsAtGTENow bool, c *gin.Context) (*time.Time, *time.Time, error)

Types

type Price added in v0.0.8

type Price int64

func NewPrice added in v0.0.8

func NewPrice(amount float64) Price

func NewTotalPrice added in v0.0.8

func NewTotalPrice(amount float64, quantity uint64) Price

func (Price) Float added in v0.0.8

func (c Price) Float() float64

func (Price) String added in v0.0.8

func (c Price) String() string

func (Price) StringWithCurrency added in v0.0.8

func (c Price) StringWithCurrency(currencySymbol string) string

func (Price) Units added in v0.0.8

func (c Price) Units() int64

type TimeDifference added in v0.0.8

type TimeDifference struct {
	Years, Months, Days, Hours, Minutes, Seconds int
}

func GetTimeDifference added in v0.0.8

func GetTimeDifference(from, to time.Time) *TimeDifference

Jump to

Keyboard shortcuts

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