functions

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OTP_Length int = 6
)
View Source
var SanitizeInputRegex *regexp.Regexp = regexp.MustCompile(`^[a-zA-Z0-9@._-]+$`)

Functions

func CompressString

func CompressString(s string) string

func ConvertToEnglishDigits

func ConvertToEnglishDigits(input string) string

Converts any digits in the input string to English digits

func DecodeBase64

func DecodeBase64(data string) ([]byte, error)

func GenerateOTP

func GenerateOTP() (string, error)

func GenerateRandomKey

func GenerateRandomKey(length int) (string, error)

func GenerateUUID

func GenerateUUID() string

func GetJsonMapFromFile

func GetJsonMapFromFile(path string) (map[string]interface{}, error)

func HasValidExtension

func HasValidExtension(name string, validExtensions map[string]struct{}) bool

Check if the given file name has a valid extension from the provided list

func IsEmail

func IsEmail(email string) (string, bool)

IsEmail checks if the input string matches a standard email format

func IsPhone

func IsPhone(phone string) (string, bool)

isPhoneNumber checks if the input string matches a standard phone number format.

func Is_IR_Phone

func Is_IR_Phone(phone string) bool

func PhoneOrMail

func PhoneOrMail(data string) (string, string)

func SafeString

func SafeString(input string, charsToRemove []rune) string

Sanitize the entire input string by processing it in chunks

func SanitizeInput

func SanitizeInput(input string) (string, error)

func StrToOriginal

func StrToOriginal(value string, targetType string) (interface{}, error)

Converts string values to the specified target type

func ToBase64

func ToBase64(data []byte) string

Function to convert data to JSON format

func ToJSON

func ToJSON(data interface{}) string

Function to convert data to JSON format

func UnJSON

func UnJSON(data []byte) (map[string]interface{}, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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