helper

package
v0.0.0-...-0eaed87 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesIntoInterface

func BytesIntoInterface(data []byte, v interface{}) error

BytesIntoInterface ...

func CalcDistanceGeo

func CalcDistanceGeo(lat float64, long float64, lat2 float64, long2 float64) uint

CalcDistanceGeo calculate distance 2 coordinate lat long @params: latitude ,Longitude,latitude2 ,Longitude2

func CheckFolder

func CheckFolder(path string) error

CheckFolder function check folder

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

CheckPasswordHash ...

func ComparePointerTime

func ComparePointerTime(time1 *time.Time, time2 *time.Time) bool

ComparePinterTime Input 2 data from *time.Time and the comparison is if a < b return true else false

func CompareSignatureKey

func CompareSignatureKey(data string, signatureKey string, typeModule string) bool

CompareSignatureKey ...

func ContainsList

func ContainsList(str string, s []string) bool

ContainsList checks if a string is present in a slice

func ConvertImageToBase64

func ConvertImageToBase64(folder string, filename string) string

ConvertImageToBase64 convert local image to base64 string

func ConvertStructToInterface

func ConvertStructToInterface(unchangedValue interface{}, changedValue interface{}) ([]string, *map[string]interface{})

ConvertStructToInterface ...

func DecryptAES

func DecryptAES(encryptedString string) (string, error)

DecryptAES ...

func DownloadFileURL

func DownloadFileURL(URL, folder string, fileName string) (string, error)

DownloadFileURL ...

func EmailTemplate

func EmailTemplate(htmlTemplate string, emailData map[string]interface{}) string

EmailTemplate ...

func EncryptAES

func EncryptAES(stringToEncrypt string) (string, error)

EncryptAES ...

func FcmMessage

func FcmMessage(message map[string]interface{}) bool

FcmMessage ...

func FileRemove

func FileRemove(path string) error

FileRemove Remove Files

func FindURLImageTarget

func FindURLImageTarget(targets string) bool

FindURLImageTarget check key for slice

func GenerateRandomString

func GenerateRandomString(length int) string

GenerateRandomString params @length: int return string

func GenerateReferralCode

func GenerateReferralCode() string

GenerateReferralCode ...

func GenerateStringWithCharSet

func GenerateStringWithCharSet(length int) string

GenerateStringWithCharSet params @Length: int return string

func GetDifferentValueStruct

func GetDifferentValueStruct(original interface{}, new interface{}) map[string]interface{}

GetDifferentValueStruct get map[string]interface{} if value of different field value compare 2 structs and return different field value only @note 2 structs must be same field and type @params original interface{},new interface{} @return map[string]interface{}

func GetDiscountPercentage

func GetDiscountPercentage(original float64, discounted float64) uint

GetDiscountPercentage ..

func GetEnv

func GetEnv(key string, defaultValue string) string

GetEnv ...

func GetLastStartSessionDay

func GetLastStartSessionDay() time.Time

GetLastStartSessionDay get date of monday session

func HashIDDecode

func HashIDDecode(key string) (uint, bool)

HashIDDecode ...

func HashIDEncode

func HashIDEncode(id uint) string

HashIDEncode ...

func HashPassword

func HashPassword(password string) (string, error)

HashPassword ...

func InterfacetoBytes

func InterfacetoBytes(v interface{}) ([]byte, error)

InterfacetoBytes ...

func IsValidUUID

func IsValidUUID(uuid string) bool

IsValidUUID params @summary check if UUID is valid with regex @uuid: string return bool

func JoinStrings

func JoinStrings(str []string) string

JoinStrings params @summary join string with array seperator [","] @str: []string return string

func MakeDirs

func MakeDirs(path string) error

MakeDirs fucntion create directory

func ParsingSpecialStringAlphanumeric

func ParsingSpecialStringAlphanumeric(text string) string

ParsingSpecialStringAlphanumeric func @text: string return string

func ParsingSpecialStringForS3

func ParsingSpecialStringForS3(text string) string

ParsingSpecialStringForS3 func @text: string return string

func PlateNumberValidator

func PlateNumberValidator(num string) (string, error)

func PointerBool

func PointerBool(value *bool) bool

func PointerFloat64

func PointerFloat64(value *float64) float64

PointerFloat64 ...

func PointerInt

func PointerInt(value *int) int

func PointerString

func PointerString(str *string) string

PointerString ...

func PointerUint

func PointerUint(value *uint) uint

PointerUint ...

func PointerUintToPointerBool

func PointerUintToPointerBool(value *uint) *bool

func QueryBuilder

func QueryBuilder(query map[string]string) *dto.Filter

QueryBuilder ...

func QueryParser

func QueryParser(query map[string][]string) map[string]string

QueryParser

func RandInt

func RandInt(min int, max int) int

RandInt random min max value

func RequestBody

func RequestBody(context *gin.Context, order interface{}) error

RequestBody ...

func Reverse

func Reverse(str string) (result string)

Reverse ...

func SetBool

func SetBool(value bool) *bool

SetBool ...

func SetFCMTopic

func SetFCMTopic(registrationID string, topic string, fcmType string) bool

SetFCMTopic ...

func SetFloat64

func SetFloat64(value float64) *float64

SetFloat64 ...

func SetInt

func SetInt(value int) *int

SetInt ...

func SetString

func SetString(value string) *string

SetString ...

func SetUint

func SetUint(value uint) *uint

SetUint ...

func Slugify

func Slugify(str string) string

Slugify ...

func StrToUint64

func StrToUint64(value string) uint64

StrToUint64 ...

func StringPick

func StringPick(str string, min float64, max float64) string

StringPick ...

func StringShuffle

func StringShuffle(str string) string

StringShuffle ..

func StringToInt

func StringToInt(str string) int

StringToInt ..

func StringToInt64

func StringToInt64(str string) int64

StringToInt64 ...

func TimeTrack

func TimeTrack(start time.Time, name string)

func ToJSONDOB

func ToJSONDOB(dob string) string

ToJSONDOB check dob

func ToJSONFloat64

func ToJSONFloat64(data *float64) *float64

ToJSONFloat64 check and convert to unix

func ToJSONImage

func ToJSONImage(pathImg string) string

ToJSONImage check image

func ToJSONUnix

func ToJSONUnix(date *time.Time) interface{}

ToJSONUnix check and convert to unix

func ToJSONVideo

func ToJSONVideo(pathVideo string) string

ToJSONVideo check image

func ToString

func ToString(value interface{}) string

ToString converts a value to string.

func UnixToDate

func UnixToDate(unixString string) *time.Time

func UploadFile

func UploadFile(gcsfolder, filepath, filename string) (*string, error)

func UploadImage

func UploadImage(base64image string, folder string, filename string) (*string, error)

UploadImage ... return path, error

func ZeroValuesHandler

func ZeroValuesHandler(request interface{}) map[string]interface{}

ZeroValuesHandler get map[string]interface{} if value of different field value compare 2 structs and return different field value only @note 2 structs must be same field and type @params original interface{},new interface{} @return map[string]interface{}

Types

type MailgunTemplate

type MailgunTemplate struct {
	Sender     string
	Subject    string
	Body       string
	Recipient  string
	HTMLString string
}

MailgunTemplate ...

func (*MailgunTemplate) SendEmail

func (mt *MailgunTemplate) SendEmail()

SendEmail mailgun

type SendGrid

type SendGrid struct {
	I18n *i18n.I18n
}

SendGrid ...

func SendGridHandler

func SendGridHandler() *SendGrid

SendGridHandler ...

func (*SendGrid) SendEmail

func (s *SendGrid) SendEmail(name string, email string, otp int, subject string, langCode string) bool

SendEmail ...

type SendGridInterface

type SendGridInterface interface {
	SendEmail(name string, email string, otp int, subject string, langCode string) bool
}

SendGridInterface ...

Jump to

Keyboard shortcuts

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