helper

package
v0.8.55 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: MIT Imports: 30 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 BasicAuth added in v0.8.35

func BasicAuth(username, password string) string

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 Call added in v0.3.3

func Call(ctx context.Context,
	method,
	url string,
	headers map[string]string,
	timeout time.Duration,
	payload interface{},
	cookies []*http.Cookie) ([]byte, http.Header, int, error)

Call helper for api calls TODO : make service and use debug service to

func CallXML added in v0.5.0

func CallXML(ctx context.Context,
	method,
	url string,
	headers map[string]string,
	timeout time.Duration,
	payload interface{},
	cookies []*http.Cookie) ([]byte, http.Header, int, 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 *beeorm.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 GraphqlErr added in v0.1.3

func GraphqlErr(path []string, msg string) error

func HasIntersectionInt added in v0.1.3

func HasIntersectionInt(a []int, b []int) bool

func HasIntersectionInt32 added in v0.1.3

func HasIntersectionInt32(a []int32, b []int32) bool

func HasIntersectionInt64 added in v0.1.3

func HasIntersectionInt64(a []int64, b []int64) bool

func HasIntersectionUInt32 added in v0.1.3

func HasIntersectionUInt32(a []uint32, b []uint32) bool

func HasIntersectionUInt64 added in v0.1.3

func HasIntersectionUInt64(a []uint64, b []uint64) bool

func Int32InArray added in v0.1.3

func Int32InArray(s int32, arr ...int32) bool

func Int64InArray added in v0.1.3

func Int64InArray(s int64, arr ...int64) bool

func IntInArray added in v0.1.3

func IntInArray(s int, arr ...int) bool

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 *beeorm.Pager) string

func SliceUint64Difference added in v0.0.8

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

func StringInArray added in v0.1.3

func StringInArray(s string, arr ...string) bool

func SubtractInt32Slice added in v0.1.7

func SubtractInt32Slice(a []int32, b []int32) []int32

func SubtractInt64Slice added in v0.1.7

func SubtractInt64Slice(a []int64, b []int64) []int64

func SubtractIntSlice added in v0.1.7

func SubtractIntSlice(a []int, b []int) []int

func SubtractUInt32Slice added in v0.1.7

func SubtractUInt32Slice(a []uint32, b []uint32) []uint32

func SubtractUInt64Slice added in v0.1.7

func SubtractUInt64Slice(a []uint64, b []uint64) []uint64

func SubtractUIntSlice added in v0.1.7

func SubtractUIntSlice(a []uint, b []uint) []uint

func TruncateTime added in v0.8.54

func TruncateTime(in time.Time) time.Time

func UIn32tInArray added in v0.1.3

func UIn32tInArray(s uint32, arr ...uint32) bool

func UIn64tInArray added in v0.1.3

func UIn64tInArray(s uint64, arr ...uint64) bool

func UniqueInt added in v0.1.3

func UniqueInt(a []int) []int

func UniqueInt32 added in v0.1.3

func UniqueInt32(a []int32) []int32

func UniqueInt64 added in v0.1.3

func UniqueInt64(a []int64) []int64

func UniqueString added in v0.1.3

func UniqueString(a []string) []string

func UniqueUInt32 added in v0.1.3

func UniqueUInt32(a []uint32) []uint32

func UniqueUInt64 added in v0.1.3

func UniqueUInt64(a []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

type URLQueryPager added in v0.2.1

type URLQueryPager struct {
	// example = ?current_page=1&page_size=25
	CurrentPage int `binding:"min=1" form:"current_page"`
	PageSize    int `binding:"min=1" form:"page_size"`
}

type Validator added in v0.2.6

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

func NewValidator added in v0.2.6

func NewValidator() *Validator

func (*Validator) Validate added in v0.2.6

func (t *Validator) Validate(field interface{}, rules string) []error

Jump to

Keyboard shortcuts

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