utils

package
v1.206.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clone added in v1.188.0

func Clone[T any](fromValue T) (toValue T)

func CorsHeaders

func CorsHeaders() map[string]string

CorsHeaders returns a map to allow Cors

func DeepCopy

func DeepCopy(fromValue interface{}) (toValue interface{})

func DetermineDaysLeft added in v1.201.0

func DetermineDaysLeft(fromDateLocal time.Time, toDateLocal time.Time) int

func FormatPhoneNumber added in v1.113.0

func FormatPhoneNumber(phoneNumber string) string

func GetEnv

func GetEnv(name string, def string) (env string)

GetEnv is a helper function for getting environment variables with a default

func IsEqual added in v1.121.0

func IsEqual(expected interface{}, actual interface{}) bool

IsEqual returns if the two objects are equal

func IsUrlStrict added in v1.113.0

func IsUrlStrict(str string) bool

IsUrlStrict Returns whether a URL is valid in a strict way (Must have scheme and host)

func IsValidUsername added in v1.113.0

func IsValidUsername(str string) bool

func PointerToValue added in v1.113.0

func PointerToValue[V any](value *V) V

func RemoveUrlScheme added in v1.113.0

func RemoveUrlScheme(str string) string

RemoveUrlScheme Removes http:// or https:// from a URL

func SplitAndCleanEmailAddresses added in v1.201.0

func SplitAndCleanEmailAddresses(emails string) []string

func StandardisePhoneNumber added in v1.113.0

func StandardisePhoneNumber(number string) string

StandardisePhoneNumber standardises phone numbers with +27 instead of 0 prefix

func StripEmail added in v1.181.0

func StripEmail(email string) (strippedEmail string, strippedDomain string)

func StripQueryString added in v1.113.0

func StripQueryString(inputUrl string) (string, error)

StripQueryString - Strips the query parameters from a URL

func ValidateEmailAddress added in v1.113.0

func ValidateEmailAddress(email string) (string, error)

func ValueToPointer added in v1.113.0

func ValueToPointer[V any](value V) *V

Types

This section is empty.

Jump to

Keyboard shortcuts

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