Documentation ¶
Index ¶
- Variables
- func AmountFromDebitCredit(debit, credit interface{}) (famount string)
- func AmountInWords(amount interface{}) (inwords string)
- func ArrayDiff(a, b []string) []string
- func ArrayDuplicate(a, b []string) []string
- func ArrayFind(array []string, value string) (bool, int)
- func ArrayValueExist(array []string, value string) bool
- func BrowserInfo(userAgent, battery string) map[string]string
- func BrowserInfo2(userAgent string) map[string]string
- func Call(m map[string]interface{}, name string, params ...interface{}) (result []reflect.Value, err error)
- func CheckFileOrFolderExist(dirName string) bool
- func CleanText(example string) string
- func Convert(number int) string
- func ConvertAnd(number int) string
- func DateInBetween(dateFormat, compareDate, startDate, endDate string) bool
- func DateTimeParser(inputDateTime, inputFormat, outputFormat string) (datetime string)
- func DayCountBetweenTwoDates(startDate, endDate string) int
- func DecodeStr(hexcode, password string) (plaintext string)
- func DivideBy(a, b interface{}) float64
- func EncodeStr(text, password string) (hexcode string)
- func ErrorInSlice(slice []string, val string) (int, bool)
- func FormateDate(date string) (fdate string)
- func GenerateBlockNumber() (blockNumber string)
- func GenerateDocNumber(prefix string) (docNumber string)
- func GenerateLedgerNumber(prefix, suffix string) (ledgerNumber string)
- func GenerateVisitorSession() string
- func GetFieldValue(tableRows []map[string]interface{}, fieldName, findMyName string) (sRow map[string]interface{})
- func GetImageMenus(tableRows []map[string]interface{}, menuID string) map[string]interface{}
- func GetLinkRow(tableRows []map[string]interface{}, imenuID string) (sRow []map[string]interface{})
- func GetLinkRowByField(tableRows []map[string]interface{}, fieldName, menuID string) (sRow []map[string]interface{})
- func GetMapValue(mapData map[string]string, key string) (val string)
- func GetMapValueI(mapData map[string]interface{}, key string) (val string)
- func GetMatchedRow(tableRows []map[string]interface{}, fieldName, matchValue string) (sRow []map[string]interface{})
- func GetSign(voucherName string) (sign string)
- func GetStructName(myvar interface{}) string
- func GetTextMenus(tableRows []map[string]interface{}, menuID string) map[string]interface{}
- func GetVarType(myvar interface{}) string
- func HashBcrypt(password string) (hash string)
- func HashCompare(password, hashpassword string) bool
- func IPAddress(RemoteAddr string) (ipaddress string)
- func LinkDetailsParser(data string) map[string]string
- func MapToCleanFieldSlice(sfMap map[string]string) []string
- func MapToString(sRow map[string]string) string
- func Mformat(a interface{}) string
- func Mminus(a, b interface{}) float64
- func MoneyFormat(amount interface{}) string
- func MtoFloat64(a interface{}) float64
- func MtoString(a interface{}) string
- func PaddingLeft(seed interface{}, padStr string, length int) (retStr string)
- func PaddingRight(seed interface{}, padStr string, length int) (retStr string)
- func ParseDimension(text, separator string) map[string]string
- func Plus(a, b interface{}) float64
- func ReadUserIP(r *http.Request) string
- func RegExFindMatch(pattern, data string) (match []string)
- func RemoveFromSlice(s []string, i int) []string
- func RemoveFromSliceByValue(s []string, value string) []string
- func ReplaceSpaceBy(productName, replaceby string) (formattedName string)
- func RequestURLtoPage(requestURI string) (pageName, query string)
- func ReturnIndexByValue(s []string, val string) (index int)
- func SQLNullString(s interface{}) sql.NullString
- func SliceValueExist[T comparable](s []T, v T) bool
- func StartEndDate(dateTime, layout string) (startDate, endDate string)
- func StringInSlice(slice []string, val string) (int, bool)
- func StringToMap(output string) map[string]string
- func StringToSlice(text, separator string) (slice []string)
- func StructToFields(structRef interface{}) []string
- func StructToFieldsType(structRef interface{}) map[string]string
- func SubTotal(data []map[string]interface{}) float64
- func Sum(nums ...float64) (total float64)
- func TimeNow() string
- func TimeNowFormatted(timeFormat string) string
- func TimeStampToDate(timeStamp string) (dateFormated string)
- func ToString(data interface{}) string
- func ToTitle(str string) string
- func Uplus(nums ...interface{}) string
- func ValueType(v interface{}) string
- func WishList(productID string, wisthList []map[string]interface{}) bool
Constants ¶
This section is empty.
Variables ¶
var FuncMap = template.FuncMap{ "minus": Mminus, "mFormat": Mformat, "toFloat64": MtoFloat64, "toString": MtoString, "toWords": AmountInWords, "plus": Plus, "getFieldValue": GetFieldValue, "sign": GetSign, "fdate": FormateDate, "famount": AmountFromDebitCredit, "getTextMenus": GetTextMenus, "getImageMenus": GetImageMenus, "getMatchedRow": GetMatchedRow, "getLinkRow": GetLinkRow, "getLinkRowByField": GetLinkRowByField, "moneyFormat": MoneyFormat, "detailsParser": LinkDetailsParser, "subTotal": SubTotal, "replaceSpace": ReplaceSpaceBy, "toSlice": StringToSlice, "parseDimension": ParseDimension, "uPlus": Uplus, "wishList": WishList, "divideBy": DivideBy, }
FuncMap Custom function repository used in template
Functions ¶
func AmountFromDebitCredit ¶
func AmountFromDebitCredit(debit, credit interface{}) (famount string)
AmountFromDebitCredit to get which one has value not 0
func AmountInWords ¶
func AmountInWords(amount interface{}) (inwords string)
AmountInWords any type amount to string type conversion
func ArrayDuplicate ¶
ArrayDuplicate Get the duplicate value array from two different array
func ArrayValueExist ¶
ArrayValueExist Make sure a value exist in_array or not
func BrowserInfo ¶
BrowserInfo parse useragent to map
func BrowserInfo2 ¶
BrowserInfo2 parse useragent to map
func Call ¶
func Call(m map[string]interface{}, name string, params ...interface{}) (result []reflect.Value, err error)
Call advance func used in
func CheckFileOrFolderExist ¶
CheckFileOrFolderExist takes one argument
func ConvertAnd ¶
ConvertAnd converts number into the words representation with " and " added between number groups.
func DateInBetween ¶
func DateTimeParser ¶
DateTimeParser datetime parser according to your format
func DayCountBetweenTwoDates ¶
func DivideBy ¶
func DivideBy(a, b interface{}) float64
DivideBy to division on golang html template
func ErrorInSlice ¶
ErrorInSlice to detect error in a string
func GenerateBlockNumber ¶
func GenerateBlockNumber() (blockNumber string)
GenerateBlockNumber unique hexa code
func GenerateDocNumber ¶
GenerateDocNumber to Generate random unique document number
func GenerateLedgerNumber ¶
GenerateLedgerNumber for accounting voucher
func GenerateVisitorSession ¶
func GenerateVisitorSession() string
GenerateVisitorSession using uuid
func GetFieldValue ¶
func GetFieldValue(tableRows []map[string]interface{}, fieldName, findMyName string) (sRow map[string]interface{})
GetFieldValue to get any field value
func GetImageMenus ¶
GetImageMenus for link create purpose
func GetLinkRow ¶
GetLinkRow getMatchedRow for go template
func GetLinkRowByField ¶
func GetLinkRowByField(tableRows []map[string]interface{}, fieldName, menuID string) (sRow []map[string]interface{})
GetLinkRowByField for template page
func GetMapValue ¶
GetMapValue safer way to get value from map
func GetMapValueI ¶
GetMapValueI safer way to get value from map
func GetMatchedRow ¶
func GetMatchedRow(tableRows []map[string]interface{}, fieldName, matchValue string) (sRow []map[string]interface{})
GetMatchedRow for golang html template
func GetStructName ¶
func GetStructName(myvar interface{}) string
GetStructName get struct to its name
func GetTextMenus ¶
GetTextMenus for text link
func GetVarType ¶
func GetVarType(myvar interface{}) string
GetVarType any variable to its underlysing data type
func HashCompare ¶
HashCompare compare plaintext password with hash text
func LinkDetailsParser ¶
LinkDetailsParser link string to map
func MapToCleanFieldSlice ¶
MapToCleanFieldSlice ...
func MapToString ¶
MapToString map to string comma separated input=map[access_name:student cid:1 login_id:2] output=access_name:student,cid:1,login_id:2
func Mformat ¶
func Mformat(a interface{}) string
Mformat Custom function for template. Takes an input (Any type including int,float64,string) Return two decimal digit after the point/precision
func Mminus ¶
func Mminus(a, b interface{}) float64
Mminus Custom function for template, Takes two input and return result after subtraction
func MoneyFormat ¶
func MoneyFormat(amount interface{}) string
MoneyFormat format any number to money format, comma separated
func MtoFloat64 ¶
func MtoFloat64(a interface{}) float64
MtoFloat64 Custom function for template. Takes an input (Any type including int,float64,string) Convert it to float64 and return
func MtoString ¶
func MtoString(a interface{}) string
MtoString Custom function for template, Takes one input of any formate and convert it to string
func PaddingLeft ¶
PaddingLeft ..
func PaddingRight ¶
PaddingRight ...
func ParseDimension ¶
ParseDimension for samsung/FDL company mobile handset only
func ReadUserIP ¶
ReadUserIP read ip from http pointer to request
func RegExFindMatch ¶
RegExFindMatch find pattern in data string
func RemoveFromSlice ¶
RemoveFromSlice Remove an item from a slice
func RemoveFromSliceByValue ¶
RemoveFromSliceByValue Remove an item from a slice
func ReplaceSpaceBy ¶
ReplaceSpaceBy remove space by any given char
func RequestURLtoPage ¶
RequestURLtoPage r.RequestURI to path and query string
func ReturnIndexByValue ¶
ReturnIndexByValue to Get index number by its value from a slice
func SQLNullString ¶
func SQLNullString(s interface{}) sql.NullString
SQLNullString for sql null char
func SliceValueExist ¶
func SliceValueExist[T comparable](s []T, v T) bool
Generics implementation, golang version 1.18 required
func StartEndDate ¶
StartEndDate takes two argument, both are string, dateTime="", layout := "2006-01-02 03:04:05"
func StringToMap ¶
StringToMap comma separated string to map input=access_name:student,cid:1,login_id:2 output=map[access_name:student cid:1 login_id:2]
func StringToSlice ¶
StringToSlice create a slice using separator
func StructToFields ¶
func StructToFields(structRef interface{}) []string
StructToFields structToFields
func StructToFieldsType ¶
StructToFieldsType get struct to its field_name and data type
func Sum ¶
Sum input as many number as wish, get all number summation ex: 10.50,20.03,50.25 or slice ending with three dots[slice...]-> tool.Sum(aSlice...)
func TimeNow ¶
func TimeNow() string
TimeNow current system time mysql datetime format 2006-01-02 15:04:05 = 4digitYear-2digitMonth-2digitDate 24HourFormatHour:minute:second
func TimeNowFormatted ¶
TimeNowFormatted "2006-01-02 15:04:05" Any format you wish as an output
func TimeStampToDate ¶
TimeStampToDate formatted date
Types ¶
This section is empty.