Documentation
¶
Index ¶
- Variables
- func FormatBytes(bytes uint64) string
- func GetJwtString(id uint, name, role string) (string, error)
- func GetJwtStringWithClaims(id uint, name, role string, custom map[string]any) (string, error)
- func GetRawJwtString(claims jwt.MapClaims) (string, error)
- func HTTPRequest[T any](url string, method string, params map[string]string, payload map[string]any) (response *T, err error)
- func In[T comparable](key T, values ...T) bool
- func Insert[T any](slice []T, elem T, index uint) []T
- func LastElem[T any](slice []T) T
- func Move[T comparable](slice []T, elem T, to uint) []T
- func NilOrBaseValue[T, U any](v *T, fn func(*T) U, def U) U
- func NilOrLazyValue[T, U any](v *T, fn func(*T) *U) *U
- func NilOrPtrCast[U any](v any) *U
- func NilOrValue[T, U any](v *T, obj *U) *U
- func NotEmpty(s, def string) string
- func NotEmptyFieldName(s any) (names []string)
- func NotNil[T, U any](v *T, u *T) *T
- func ProcessString(str string, vars interface{}) string
- func ProcessStringWithTPL(tpl *template.Template, str string, vars interface{}) string
- func RandomString(n int) string
- func Remove[T comparable](slice []T, elems ...T) []T
- func RemoveByRef[T any](slice []T, elems ...*T) []T
- func Tenary[T any](cond bool, a, b T) T
- func ToUint[T ~int | ~int8 | ~int16 | ~int32 | ~int64](n T) uint
- func TransSlice[T, U any](s []T, trans func(T) U) (us []U)
- type AtomPtr
- type CoPtrMap
Constants ¶
This section is empty.
Variables ¶
View Source
var ( EmailRegex = regexp.MustCompile(`^[^@ \t\r\n]+@[^@ \t\r\n]+\.[^@ \t\r\n]+$`) PhoneRegex = regexp.MustCompile(`^[0-9]{3}[-\s\.]?[0-9]{4}([-\s\.]?[0-9]{4})?$`) )
View Source
var Validator *validator.Validate
Functions ¶
func FormatBytes ¶
func GetJwtStringWithClaims ¶
func HTTPRequest ¶
func In ¶
func In[T comparable](key T, values ...T) bool
func Move ¶
func Move[T comparable](slice []T, elem T, to uint) []T
func NilOrBaseValue ¶
func NilOrBaseValue[T, U any](v *T, fn func(*T) U, def U) U
func NilOrLazyValue ¶
func NilOrLazyValue[T, U any](v *T, fn func(*T) *U) *U
func NilOrPtrCast ¶
func NilOrValue ¶
func NilOrValue[T, U any](v *T, obj *U) *U
func NotEmptyFieldName ¶
NotEmptyFieldName Get the json tag name of a struct field that is not empty
func ProcessString ¶
func ProcessStringWithTPL ¶
func RandomString ¶
func Remove ¶
func Remove[T comparable](slice []T, elems ...T) []T
func RemoveByRef ¶
func RemoveByRef[T any](slice []T, elems ...*T) []T
func TransSlice ¶
func TransSlice[T, U any](s []T, trans func(T) U) (us []U)
Types ¶
Click to show internal directories.
Click to hide internal directories.