commons

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 11 Imported by: 0

README

utils-go

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NumbersRegex = regexp.MustCompile("^[0-9]+$")
)

Functions

func ArrayContainsString

func ArrayContainsString(arr *[]string, str string) bool

Checks if an string array contains a given string and returns true if it is present

func ArrayContainsUint64

func ArrayContainsUint64(arr *[]uint64, value uint64) bool

func CheckPasswordSafety

func CheckPasswordSafety(s string, minLengh, maxLenght uint8) bool

func CheckPasswordSecurity

func CheckPasswordSecurity(s string, minlength, maxlengh int) bool

Check the password security: They have to be at least on upper, one lower, a number and a spacial charcter

func ComparePasswords

func ComparePasswords(hashedPwd string, plainPwd string) bool

func FindSubstringOcurrences

func FindSubstringOcurrences(text, substring string) ([]int, error)

func GenerateNumbersRandomString

func GenerateNumbersRandomString(n int) (*string, error)

GenerateNumbersRandomString returns a securely generated random string containing n numbers from 0 to 9.

It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GenerateRamdomString

func GenerateRamdomString(n int, source string) (*string, error)

GenerateRamdomString returns a securely generated random string containing n characters from source.

It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GenerateRandomBytes

func GenerateRandomBytes(n int) ([]byte, error)

GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GenerateRandomString

func GenerateRandomString(n int) (*string, error)

GenerateRandomString returns a securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GenerateRandomStringURLSafe

func GenerateRandomStringURLSafe(n int) (string, error)

GenerateRandomStringURLSafe returns a URL-safe, base64 encoded securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GenerateUpperCaseAndNumbersRandomString

func GenerateUpperCaseAndNumbersRandomString(n int) (*string, error)

GenerateUpperCaseAndNumbersRandomString returns a securely generated random string containing n uppercase letters (!O) and numbers (!0).

It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func HashAndSalt

func HashAndSalt(pwd *[]byte) string

func IsEmailValid

func IsEmailValid(e string) bool

IsEmailValid checks if a mail is valid

func IsNil

func IsNil(i interface{}) bool

func RemoveDiacritics

func RemoveDiacritics(s string) *string

func ReverseString added in v0.1.1

func ReverseString(s string) string

ReverseString reverses a string

func ToJson

func ToJson(n interface{}) (string, bool)

Types

This section is empty.

Directories

Path Synopsis
Package log implements a simple logging package.
Package log implements a simple logging package.
jwt

Jump to

Keyboard shortcuts

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