helpers

package
v0.0.0-...-d7ff5e6 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTranslationV2

func AddTranslationV2(key string)

Add Frontend Translation func

func AutoTradingColorCode

func AutoTradingColorCode(code string) string

func BalanceFormat

func BalanceFormat(value float64, d int) (s string)

helpers.BalanceFormat(helpers.NumberFormat2Dec("123123.800"), 8)

func BytesToString

func BytesToString(b []byte) string

func CompareDateTime

func CompareDateTime(dateTimeStart time.Time, operand string, dateTimeEnd time.Time) bool

func Contains

func Contains(arr []string, str string) bool

func ConvertTimeToUnix

func ConvertTimeToUnix(value time.Time) string

func CutOffDecimal

func CutOffDecimal(number float64, decimals uint, decPoint, thousandsSep string) string

func CutOffDecimalBK

func CutOffDecimalBK(number float64, decimals uint, decPoint, thousandsSep string) string

func CutOffDecimalBK

func CutOffDecimalBK2

func CutOffDecimalBK2(number float64, decimals uint, decPoint, thousandsSep string) string

func CutOffDecimalv2

func CutOffDecimalv2(number float64, decimals uint, decPoint, thousandsSep string, flexZeroDecPointStatus bool) string

func CutOffStringsDecimal

func CutOffStringsDecimal(number string, decimals uint, decPoint byte) string

func DetrailZeroFloat

func DetrailZeroFloat(value float64, d int) (s float64)

func Explode

func Explode(str, delimiter string) []string

func FNV32a

func FNV32a(text string) uint32

FNV32a hashes using fnv32a algorithm

func Float64InSlice

func Float64InSlice(a float64, list []float64) bool

Float64InSlice verify if int in slice

func FloatEquality

func FloatEquality(a, b float64) bool

func GenCheckSum

func GenCheckSum(memId string, walletId string, docNo string, transactionType string, gameId string, date string) (string, error)

func GetBinanceMarketPrice

func GetBinanceMarketPrice(WalletType string) (float64, string)

get market price from binance

func GetCurrentTime

func GetCurrentTime() string

func GetDaysInCurrentMonth

func GetDaysInCurrentMonth() []time.Time

func GetEncryptedID

func GetEncryptedID(code string, id int) string

GetEncryptedID func

func GetLatestMonths

func GetLatestMonths(n int) []map[string]time.Time

func GetLatestWeeks

func GetLatestWeeks(n int) []map[string]time.Time

func GetLatestYears

func GetLatestYears(n int) []map[string]time.Time

func GetMonthStartAndEndDatesWithinDateRange

func GetMonthStartAndEndDatesWithinDateRange(dateStart, dateEnd time.Time) []map[string]time.Time

func GetStatusColorCodeByStatusCode

func GetStatusColorCodeByStatusCode(statusCode string) string

func GetStringInBetween

func GetStringInBetween(str string, start string, end string) (result string)

GetStringInBetween Returns empty string if no start string found

func GetWeekStartAndEndDatesWithinDateRange

func GetWeekStartAndEndDatesWithinDateRange(dateStart, dateEnd time.Time) []map[string]time.Time

func GetYearStartAndEndDatesWithinDateRange

func GetYearStartAndEndDatesWithinDateRange(dateStart, dateEnd time.Time) []map[string]time.Time

func IntInSlice

func IntInSlice(a int, list []int) bool

IntInSlice verify if int in slice

func IsArray

func IsArray(m map[string]interface{}) bool

IsArray func to check if interface is array

func IsMultipleOf

func IsMultipleOf(value, multipleOf float64) bool

IsMultipleOf func

func IsNumeric

func IsNumeric(s string) bool

func MaskLeft

func MaskLeft(s string, num int) string

MaskLeft func

func MonthStartEndDate

func MonthStartEndDate(date time.Time) (monthStart, monthEnd time.Time)

func NumDecPlaces

func NumDecPlaces(v float64) int

func NumberFormat

func NumberFormat(value float64, d int) (f float64)

slice decimal without rounding off, d must always equal or greater then zero

func NumberFormat2Dec

func NumberFormat2Dec(s string) float64

func NumberFormatInt

func NumberFormatInt(s string) int

func NumberFormatInt64

func NumberFormatInt64(s string) int64

func NumberFormatPhp

func NumberFormatPhp(number float64, decimals uint, decPoint, thousandsSep string) string

func NumberFormatPhp. this is work like php number_format

func Paginate

func Paginate(pageNum int, pageSize int, sliceLength int) (int, int)

Paginate function

func ProcessNumberToDesirePart2String

func ProcessNumberToDesirePart2String(neg bool, str string, dec int, decPoint string, thousandsSep string) string

func ProcessNumberToDesireString

func ProcessNumberToDesireString(number string, dec int) string

func RandomInt

func RandomInt(min, max int) int

Returns an int >= min, < max

func SpaceStringsBuilder

func SpaceStringsBuilder(str string) string

func StringInSlice

func StringInSlice(a string, list []string) bool

StringInSlice verify if string in slice

func StringToSliceInt

func StringToSliceInt(stringList string, separator string) []int

StringToSliceInt convert string into slice of int. example 9,10 into []int{9,10}

func Substr

func Substr(str string, start uint, length int) string

Substr. this is work like php substr()

func Textify

func Textify(value float64) (s string)

func TrailZeroFloat

func TrailZeroFloat(value float64, d int) (s float64)

func TransDiamondName

func TransDiamondName(diamondName, langCode string) string

TransDiamondName translate diamond name dynamically

func TransRemark

func TransRemark(word string, langCode string) string

func Translate

func Translate(word string, langCode string) string

func TranslateV2

func TranslateV2(word string, langCode string, params map[string]string) string

TranslateV2 version 2: support replace value

func TruncateToDay

func TruncateToDay(t time.Time) time.Time

func ValueToBool

func ValueToBool(value string) (bool, error)

ValueToBool convert value to boolean

func ValueToDuration

func ValueToDuration(value string) (time.Duration, error)

ValueToDuration convert value to duration

func ValueToFloat

func ValueToFloat(value string) (float64, error)

ValueToFloat convert value to float

func ValueToInt

func ValueToInt(value string) (int, error)

ValueToInt convert value to Int

func WeekEndDate

func WeekEndDate(date time.Time) time.Time

func WeekStartDate

func WeekStartDate(date time.Time) time.Time

func YearStartEndDate

func YearStartEndDate(date time.Time) (yearStart, yearEnd time.Time)

Types

type FMarketPriceStruc

type FMarketPriceStruc struct {
	Symbol string  `json:"symbol"`
	Price  float64 `json:"price"`
}

type SMarketPriceStruc

type SMarketPriceStruc struct {
	Symbol string `json:"symbol"`
	Price  string `json:"price"`
}

Jump to

Keyboard shortcuts

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