Documentation
¶
Index ¶
- func CamelToSnake(s string) string
- func ClearSpecialCharacters(val string) string
- func Command(name string, arg ...string) interface{}
- func CompareValues(a, b interface{}) int
- func Contains(slice []string, item string) bool
- func ConvertCalculatedValue(value interface{}) interface{}
- func ConvertJSONArrayToCSV(jsonData interface{}, headingColumns []string, filename string) (string, error)
- func ConvertJSONArrayToDataArray(jsonData interface{}, headingColumns []string) ([][]string, error)
- func ConvertJSONArrayToExcel(jsonData interface{}, headingColumns []string, filename string) (string, error)
- func ConvertTo[T any](data interface{}) (T, error)
- func ConvertToDataMap(data map[string]interface{}) datatype.DataMap
- func CreateDirectory(dir string) error
- func CreateFile(data interface{}, filename string) error
- func CreateFolder(dir string) error
- func DateEnd(value interface{}) time.Time
- func DateStart(value interface{}) time.Time
- func DownloadFile(url, destPath string, progress func(downloaded, total int64)) error
- func ExtractGraphqlQuery(data interface{}, level uint) map[uint][]string
- func FileExists(filename string) bool
- func FormatPhone(phone interface{}) string
- func GetBaseUrl(str string) string
- func GetChildRelativeName(parent string, collection string, primaryKey string, foreignKey string) string
- func GetCrossPlatformIdleTime() time.Duration
- func GetDirectoryPath() string
- func GetEmailContent(layout, template string, data map[string]interface{}) string
- func GetFirst(data interface{}) interface{}
- func GetHexString(length int) string
- func GetList(data interface{}, key string) []interface{}
- func GetLocalIP() (string, error)
- func GetLocalIPS() ([]string, error)
- func GetMap(data interface{}, key string) map[string]interface{}
- func GetMapArray(data interface{}, source string, keys map[string]string) []interface{}
- func GetMapBoolean(data interface{}, key string) bool
- func GetMapDate(data interface{}, key string) time.Time
- func GetMapFloat(data interface{}, key string) float64
- func GetMapInt(data interface{}, key string) int
- func GetMapString(data interface{}, key string) string
- func GetMapValue(data interface{}, key string) interface{}
- func GetNetworkIP() (string, error)
- func GetParentRelativeName(collection string, primaryKey string, foreignKey string) string
- func GetPath(relativePath string) string
- func GetPublicIP() (string, error)
- func GetPublicPath() (string, error)
- func GetRandomInt(length int) string
- func GetRandomString(length int, typ string) string
- func GetRequest(url string, headers map[string]string) (status int, responseBody string, err error)
- func GetSortedUniqueKeys(records []datatype.DataMap) []string
- func GetTextContent(template string, data map[string]interface{}) string
- func GetTimestamp(value interface{}) time.Time
- func GetType(data interface{}) string
- func GetValueOf(data interface{}, key string) interface{}
- func GetValueOfBoolean(data interface{}, key string) bool
- func GetValueOfDate(data interface{}, key string) time.Time
- func GetValueOfFloat(data interface{}, key string) int
- func GetValueOfInt(data interface{}, key string) int
- func GetValueOfMap(data interface{}, key string) map[string]interface{}
- func GetValueOfString(data interface{}, key string) string
- func GetWhatsappContent(template string, data map[string]interface{}) interface{}
- func HomeDirectory(name string) string
- func HourEnd(value interface{}) time.Time
- func HourStart(value interface{}) time.Time
- func IsArray(v interface{}) bool
- func IsEmail(email interface{}) bool
- func IsEmailIdentifier() bool
- func IsEmpty(value interface{}) bool
- func IsList(v interface{}) bool
- func IsMap(data interface{}) bool
- func IsNotEmpty(value interface{}) bool
- func IsNumeric(value interface{}) bool
- func IsPhone(value interface{}) bool
- func IsPhoneIdentifier() bool
- func IsPointer(v interface{}) bool
- func IsSlice(v interface{}) bool
- func IsSliceOfMapStringInterface(v interface{}) bool
- func IsUsernameIdentifier() bool
- func IsWhatsappIdentifier() bool
- func LoadFile(filename string) string
- func LoadJSONFile(filename string) (map[string]interface{}, error)
- func ModifyString(value string) string
- func MonthEnd(value interface{}) time.Time
- func MonthStart(value interface{}) time.Time
- func ObjectID(id interface{}) bson.ObjectID
- func ObjectIDtoString(id bson.ObjectID) string
- func PhoneFormat(phone interface{}) string
- func Pluralize(word string) string
- func PostRequest(url string, headers map[string]string, body interface{}) (status int, responseBody string, err error)
- func Reverse[T interface{}](slice []T)
- func SaveToFile(data interface{}, filename string) error
- func Singularize(word string) string
- func SortMap[T interface{}](options map[string]T) map[string]T
- func SortedKeys[T interface{}](options map[string]T) []string
- func StringLength(value string) int
- func StringToDatetime(value interface{}) *time.Time
- func StringToTimeOnly(value interface{}) *time.Time
- func TextTemplate(templateString string, data map[string]interface{}, ...) string
- func ToByte(data interface{}) []byte
- func ToCamelCase(s string) string
- func ToFloat(value interface{}) float64
- func ToFloat64(value interface{}) float64
- func ToInt(value interface{}) int
- func ToInterface(data interface{}) (interface{}, error)
- func ToJson(data interface{}) string
- func ToList[T any](data interface{}) []T
- func ToMap[T any](data interface{}) map[string]T
- func ToMapList[T any](data interface{}) []map[string]T
- func ToSlug(s string) string
- func ToString(s interface{}) string
- func ToTimestampString(value interface{}, layout string) time.Time
- func ToTitle(s string) string
- func ToUnderscore(text string) string
- func ToVariable(s string) string
- func Today() time.Time
- func TodayEnd() time.Time
- func Tomorrow() time.Time
- func TomorrowEnd() time.Time
- func TrackTime(start *time.Time, name string)
- func UUID() string
- func ValidateEmail(email interface{}) bool
- func WeekEnd(value interface{}) time.Time
- func WeekStart(value interface{}) time.Time
- func Yesterday() time.Time
- func YesterdayEnd() time.Time
- type Objectifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CamelToSnake ¶
camelToSnake converts camelCase or PascalCase to snake_case
func ClearSpecialCharacters ¶
clearSpecialCharacters cleans the input string by replacing curly apostrophes, removing HTML tags, and keeping only allowed characters.
func CompareValues ¶
func CompareValues(a, b interface{}) int
func ConvertCalculatedValue ¶
func ConvertCalculatedValue(value interface{}) interface{}
func ConvertJSONArrayToCSV ¶
func ConvertJSONArrayToCSV(jsonData interface{}, headingColumns []string, filename string) (string, error)
ConvertJSONArrayToCSV takes a byte slice of JSON data (an array of objects) and a list of desired column names. It converts this data into a CSV string.
func ConvertJSONArrayToDataArray ¶
ConvertJSONArrayToCSV takes a byte slice of JSON data (an array of objects) and a list of desired column names. It converts this data into a CSV string.
func ConvertJSONArrayToExcel ¶
func ConvertJSONArrayToExcel(jsonData interface{}, headingColumns []string, filename string) (string, error)
ConvertJSONArrayToCSV takes a byte slice of JSON data (an array of objects) and a list of desired column names. It converts this data into a CSV string.
func ConvertToDataMap ¶
convertTo converts a map[string]interface{} to a struct of type T
func CreateDirectory ¶
func CreateFile ¶
func CreateFolder ¶
func DownloadFile ¶
DownloadFile downloads a file from URL and saves it to destPath Supports:
- Large files (streaming)
- Progress callback
- Timeout
- Resume (optional, see note below)
- Automatic directory creation
func ExtractGraphqlQuery ¶
func FormatPhone ¶
func FormatPhone(phone interface{}) string
func GetBaseUrl ¶
func GetChildRelativeName ¶
func GetCrossPlatformIdleTime ¶
The central function that calls the OS-specific function
func GetDirectoryPath ¶
func GetDirectoryPath() string
GetDirectoryPath returns the absolute path of the specified file or executable
func GetEmailContent ¶
getEmailContent reads a template file, processes it, and wraps it in a layout
func GetHexString ¶
func GetLocalIP ¶
GetLocalIP retrieves the first non-loopback local IP address
func GetLocalIPS ¶
GetLocalIP retrieves the first non-loopback local IP address
func GetMapArray ¶
func GetMapBoolean ¶
func GetMapDate ¶
func GetMapFloat ¶
func GetMapString ¶
func GetMapValue ¶
func GetMapValue(data interface{}, key string) interface{}
func GetNetworkIP ¶
GetNetworkIP retrieves the local IP and calculates the network address
func GetParentRelativeName ¶
func GetPublicIP ¶
GetPublicIP fetches the external IP address from an API
func GetPublicPath ¶
GetPublicPath returns the absolute path of a frontend file (e.g., index.html)
func GetRandomInt ¶
func GetRandomString ¶
func GetRequest ¶
GetRequest performs an HTTP GET request with the specified URL, headers, and optional body.
func GetSortedUniqueKeys ¶
GetSortedUniqueKeys extracts all unique keys (field names) from a slice of Records and returns them as an alphabetically sorted slice of strings.
func GetTextContent ¶
getTextContent reads a template file and processes it with data
func GetTimestamp ¶
func GetValueOf ¶
func GetValueOf(data interface{}, key string) interface{}
func GetValueOfBoolean ¶
func GetValueOfDate ¶
func GetValueOfFloat ¶
func GetValueOfInt ¶
func GetValueOfMap ¶
func GetValueOfString ¶
func GetWhatsappContent ¶
getWhatsappContent processes template content and attempts to parse it as JSON
func HomeDirectory ¶
func IsEmailIdentifier ¶
func IsEmailIdentifier() bool
func IsNotEmpty ¶
func IsNotEmpty(value interface{}) bool
func IsNumeric ¶
func IsNumeric(value interface{}) bool
IsNumeric checks if a value is an int, float, or a numeric string
func IsPhoneIdentifier ¶
func IsPhoneIdentifier() bool
func IsSliceOfMapStringInterface ¶
func IsSliceOfMapStringInterface(v interface{}) bool
func IsUsernameIdentifier ¶
func IsUsernameIdentifier() bool
func IsWhatsappIdentifier ¶
func IsWhatsappIdentifier() bool
func LoadJSONFile ¶
LoadJSONFile reads a JSON file and converts it to a map
func ModifyString ¶
modifyString is a placeholder implementation; adjust based on your needs
func MonthStart ¶
func ObjectIDtoString ¶
func PhoneFormat ¶
func PhoneFormat(phone interface{}) string
func PostRequest ¶
func SaveToFile ¶
func Singularize ¶
Singularize converts a plural noun to its singular form
func SortedKeys ¶
func StringLength ¶
func StringToDatetime ¶
func StringToTimeOnly ¶
func TextTemplate ¶
func TextTemplate(templateString string, data map[string]interface{}, regexPattern *regexp.Regexp) string
textTemplate replaces placeholders in templateString with values from data
func ToInterface ¶
func ToInterface(data interface{}) (interface{}, error)
func ToTimestampString ¶
func ToUnderscore ¶
ToUnderscore converts a string into snake_case format. It handles camelCase, PascalCase, and kebab-case.
func ToVariable ¶
func TomorrowEnd ¶
func ValidateEmail ¶
func ValidateEmail(email interface{}) bool
func YesterdayEnd ¶
Types ¶
type Objectifier ¶
type Objectifier struct{}
Objectifier provides methods to get or check existence of nested map values