utils

package module
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 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 added in v0.1.3

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 added in v0.1.3

func ComparePasswords(hashedPwd string, plainPwd string) bool

func FindSubstringOcurrences

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

func GenerateNumbersRandomString added in v0.1.3

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 added in v0.1.3

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 added in v0.1.3

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 added in v0.1.3

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 added in v0.1.3

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 added in v0.1.3

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 added in v0.1.3

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 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.

Jump to

Keyboard shortcuts

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