utils

package
v0.7.13 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2023 License: MIT Imports: 22 Imported by: 5

Documentation

Index

Constants

View Source
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

func ByteToMapInterface(bytes []byte) map[string]interface{}

func ByteToStruct added in v0.7.0

func ByteToStruct(raw []byte, result interface{}) error

func CompleteWithZeros

func CompleteWithZeros(str string, length int) string

func EnhanceSentryEvent added in v0.7.10

func EnhanceSentryEvent(handler http.HandlerFunc) http.HandlerFunc

func ExtractValue

func ExtractValue(key string, jwt string) (interface{}, error)

func FileExists

func FileExists(path string) bool

func GetBaseDirectory

func GetBaseDirectory(directory string) string

func GetOnlyNumbers

func GetOnlyNumbers(str string) string

func HasOnlyNumbers

func HasOnlyNumbers(str string) bool

func Hash256

func Hash256(s string) string

func Hash256FromBytes added in v0.7.11

func Hash256FromBytes(b []byte) string

func IntToString added in v0.7.13

func IntToString(in int) string

func InterfaceToInt added in v0.4.1

func InterfaceToInt(incomming interface{}) int

func MD5 added in v0.7.4

func MD5(filePath string) (string, error)

func ManageError added in v0.7.9

func ManageError(err error) error

func MapInterfaceToBytes

func MapInterfaceToBytes(data map[string]interface{}) []byte

func MapStringToMapInterface

func MapStringToMapInterface(data map[string]string) map[string]interface{}

func StringToInt added in v0.4.1

func StringToInt(in string) int

func StructToMapInterface added in v0.5.0

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

func ValidateCPF

func ValidateCPF(cpf string) bool

func ValidateCellphoneNumber

func ValidateCellphoneNumber(phoneNumber string) error

func ValidateDDD

func ValidateDDD(ddd string) bool

func ValidateEmail

func ValidateEmail(email string) bool

func ValidateLandlineNumber

func ValidateLandlineNumber(phoneNumber string) error

func ValidatePhoneNumber

func ValidatePhoneNumber(phoneNumber string) bool

func ValidateTimestamp

func ValidateTimestamp(timestamp string) bool

func ValidateURL added in v0.5.0

func ValidateURL(link string) bool

func ValidateUUID

func ValidateUUID(subject string) bool

func WhatsappNumberToBrazilianPhonenumber added in v0.7.1

func WhatsappNumberToBrazilianPhonenumber(in string) string

Types

type JwtServer

type JwtServer struct {
	Secret string
}

func NewJwtServer

func NewJwtServer(secret string) *JwtServer

func (*JwtServer) Create

func (j *JwtServer) Create(payload map[string]interface{}) (string, error)

func (*JwtServer) Parse

func (j *JwtServer) Parse(token string) (map[string]interface{}, error)

func (*JwtServer) Valid

func (j *JwtServer) Valid(token string) bool

type JwtServerInterface

type JwtServerInterface interface {
	Valid(token string) bool
	Create(payload map[string]interface{}) (string, error)
	Parse(token string) (map[string]interface{}, error)
}

Jump to

Keyboard shortcuts

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