Documentation ¶
Index ¶
- Variables
- func ComparePassword(password, hashedPassword string) error
- func Contains[T comparable](elems []T, v T, fn func(value T, element T) bool) bool
- func ConvertToFloat64(value interface{}) float64
- func GenerateCacheKey(prefix string, params any) string
- func GenerateCacheKeyParams(params ...any) string
- func HashPassword(password string) (string, error)
- func MustContainLowercase(password string) error
- func MustContainNumber(password string) error
- func MustContainSpecialChar(password string) error
- func MustContainUppercase(password string) error
- func RandomEmail() string
- func RandomInt(min, max int64) int64
- func RandomOwner() string
- func RandomPhoneNumber() string
- func RandomString(n int) string
- func RandomWebSite() string
- func SafeSQL(inputs ...string)
- func ValidateEmail(email string) error
- func ValidateName(name string) error
- func ValidatePassword(password string) error
- func ValidatePhoneNumber(phoneNumber string) error
- func ValidateString(value string, minLength int, maxLength int) error
- func ValidateSurname(name string) error
- type GenericList
- type PasswordPolicy
Constants ¶
This section is empty.
Variables ¶
View Source
var ( SQLInjectionRegexp = regexp.MustCompile(`(?i)[\s\p{Zs}]+|(select|union|insert|delete|update|where|drop|create|from|set|or|and|like|case|when|between|exists|in|not|order|by|group|having|limit|offset|truncate|alter|add|constraint|default|distinct|index|primary|key|references|foreign|check|cascade|inner|join|left|outer|right|cross|natural|on|using|as|asc|desc|into|values|having|asc|desc|sleep|')`) EmailRegexp = regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$") IsValidFullName = regexp.MustCompile(`^[a-zA-Z\s]+$`).MatchString )
Functions ¶
func ComparePassword ¶
func Contains ¶
func Contains[T comparable](elems []T, v T, fn func(value T, element T) bool) bool
func ConvertToFloat64 ¶
func ConvertToFloat64(value interface{}) float64
func GenerateCacheKey ¶
func GenerateCacheKeyParams ¶
func HashPassword ¶
func MustContainLowercase ¶
func MustContainNumber ¶
func MustContainSpecialChar ¶
func MustContainUppercase ¶
func RandomPhoneNumber ¶
func RandomPhoneNumber() string
func RandomString ¶
RandomString generates a random string of length n
func RandomWebSite ¶
func RandomWebSite() string
func ValidateEmail ¶
func ValidateName ¶
func ValidatePassword ¶
func ValidatePhoneNumber ¶
func ValidateSurname ¶
Types ¶
type GenericList ¶
type GenericList[T comparable] struct { Items []T }
func NewGenericList ¶
func NewGenericList[T comparable]() *GenericList[T]
func (*GenericList[T]) Add ¶
func (gl *GenericList[T]) Add(item T)
func (*GenericList[T]) Contains ¶
func (gl *GenericList[T]) Contains(item T) bool
func (*GenericList[T]) Get ¶
func (gl *GenericList[T]) Get(index int) (T, error)
func (*GenericList[T]) Remove ¶
func (gl *GenericList[T]) Remove(index int) error
func (*GenericList[T]) RemoveWithValue ¶
func (gl *GenericList[T]) RemoveWithValue(item T)
type PasswordPolicy ¶
PasswordPolicy is a function that checks if a password meets a certain criteria.
Click to show internal directories.
Click to hide internal directories.