Documentation ¶
Index ¶
- Constants
- func ByteToMapInterface(bytes []byte) map[string]interface{}
- func ByteToStruct(raw []byte, result interface{}) error
- func CompleteWithZeros(str string, length int) string
- func DatesInInterval(start string, end string) []string
- func EnhanceSentryEvent(handler http.HandlerFunc) http.HandlerFunc
- func ExtractFileFromBase64(r io.Reader) (*os.File, error)
- func ExtractValue(key string, jwt string) (interface{}, error)
- func FileCopy(src, dst string) error
- func FileExists(path string) bool
- func FileExtension(path string) string
- func FileMimeType(path string) string
- func FileSize(path string) int64
- func FileStartFromBase64(r io.Reader) (int, error)
- func FileToBase64(path string) (string, error)
- func FormatCPF(cpf string) (string, error)
- func GetBaseDirectory(directory string) string
- func GetFiles(path string) []string
- func GetOnlyNumbers(str string) string
- func HasOnlyNumbers(str string) bool
- func Hash256(s string) string
- func Hash256FromBytes(b []byte) string
- func HashNumber(source string) string
- func IntToCurrency(value uint) string
- func IntToString(in int) string
- func InterfaceToInt(incomming interface{}) int
- func MD5(filePath string) (string, error)
- func ManageError(err error) error
- func MapInterfaceToBytes(data map[string]interface{}) []byte
- func MapStringToMapInterface(data map[string]string) map[string]interface{}
- func MimeTypeFromBase64(r io.Reader) (string, error)
- func ReadFile(path string) ([]byte, error)
- func SHA256(filePath string) (string, error)
- func StringToInt(in string) int
- func StructToMapInterface(data interface{}) (map[string]interface{}, error)
- func ValidateCPF(cpf string) bool
- func ValidateCellphoneNumber(phoneNumber string) error
- func ValidateDDD(ddd string) bool
- func ValidateEmail(email string) bool
- func ValidateLandlineNumber(phoneNumber string) error
- func ValidatePhoneNumber(phoneNumber string) bool
- func ValidateTimestamp(timestamp string) bool
- func ValidateURL(link string) bool
- func ValidateUUID(subject string) bool
- func WhatsappNumberToBrazilianPhonenumber(in string) string
- type JwtServer
- type JwtServerInterface
Constants ¶
const ( TEST_CPF = "00000000191" TEST_TOKEN = "123456" // formas de envio de mensagem SEND_MEDIA_SMS = 1 SEND_MEDIA_EMAIL = 2 SEND_MEDIA_WHATSAPP = 3 PHONENUMBER_MAX_LENGTH = 9 PHONENUMBER_MIN_LENGTH = 8 FULL_PHONENUMBER_LENGTH = 13 WHATSAPP_PHONENUMBER_LENGTH = 12 VALID_EMAIL_REGEX = "" /* 135-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
func ByteToMapInterface ¶
Convert a byte sequence to a map[string]string
func ByteToStruct ¶ added in v0.7.0
Convert a byte sequence to a struct If some error occurs, return the error
func CompleteWithZeros ¶
Complete a string with left zeros until it reaches the desired length
func DatesInInterval ¶ added in v0.10.33
Returns a string list with the dates between the start and end dates, inclusive of both The dates must be in the format "2006-01-02"
func EnhanceSentryEvent ¶ added in v0.7.10
func EnhanceSentryEvent(handler http.HandlerFunc) http.HandlerFunc
Encapsulate the handler with Sentry
func ExtractFileFromBase64 ¶ added in v0.8.0
Extract the file from a base64 string in a slice of bytes The base64 string must be in the format "data:{mimeType};base64,...." The file is saved in a temporary directory and the path is returned The file name is a UUID to avoid conflicts
func ExtractValue ¶
Extract a value from a token.
func FileExtension ¶ added in v0.8.1
func FileMimeType ¶ added in v0.8.1
func FileToBase64 ¶ added in v0.10.34
Generate base64 string from a file the string must start with "data:{mimeType};base64," the file is read in chunks of 510 bytes because needs to be multiple of 3
func GetBaseDirectory ¶
Identify the root directory of the project. The default is the current one. If there is a running test, the root directory is the first one that contains the directory "config" or the first one inside the directory "go".
func GetOnlyNumbers ¶
Returns all numbers from a string and only the numbers
func HasOnlyNumbers ¶
func Hash256FromBytes ¶ added in v0.7.11
Calculate the SHA256 hash of a byte sequence
func HashNumber ¶ added in v0.10.41
Calculate a numeric hash of a string
func IntToCurrency ¶ added in v0.10.48
Convert an integer to currency as 1.000.000,00
func InterfaceToInt ¶ added in v0.4.1
func InterfaceToInt(incomming interface{}) int
Convert an interface to an int
func ManageError ¶ added in v0.7.9
Verify if there is an error and, in this case, try to send it to Sentry and return it. If is a running test, the error isn't sent to Sentry.
func MapInterfaceToBytes ¶
Convert a map[string]interface{} to a byte sequence
func MapStringToMapInterface ¶
Convert a map[string]string to a map[string]interface{}
func StructToMapInterface ¶ added in v0.5.0
Convert a struct to a map[string]interface{} If some error occurs, return nil and the error
func ValidateCPF ¶
func ValidateCellphoneNumber ¶
func ValidateDDD ¶
func ValidateEmail ¶
func ValidateLandlineNumber ¶
func ValidatePhoneNumber ¶
func ValidateTimestamp ¶
func ValidateURL ¶ added in v0.5.0
func ValidateUUID ¶
func WhatsappNumberToBrazilianPhonenumber ¶ added in v0.7.1
Convert a whatsapp number to a brazilian cellphonenumber