helpers

package
v0.0.0-...-4194e43 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BalanceTooLow

func BalanceTooLow(err error) bool

BalanceTooLow - checking the error for a low balance user error

func CheckOrder

func CheckOrder(s []byte) bool

CheckOrder - checking order number by luhn algorithm

func CompareCookie

func CompareCookie(c, u, h, ip, r string) bool

CompareCookie - проверка значения cookie

c - cookie value,

u - username,

h - hashed password,

ip - user ip address,

r - random string

func ComparePassword

func ComparePassword(s, h string) bool

Compare recieved password with stored value

func EmptyRow

func EmptyRow(err error) bool

EmptyRow - cheking sql error for emtry rows result set

func GenerateCookieValue

func GenerateCookieValue(u, h, ip, r string) string

GenerateCookieValue - генерация значения cookie

u - username,

h - hashed password,

ip - user ip address,

r - random string

func GetUser

func GetUser(r *http.Request) (string, error)

GetUser - getting username from request cookies

func OrderExists

func OrderExists(err error) bool

OrderExists - checking the sql error for unique violation of order number and username pair

func OrderUnique

func OrderUnique(err error) bool

OrderUnique - checking the sql error for unique violation of order number

func RandStringRunes

func RandStringRunes(n int) string

RandStringRunes - generate random string with custom lenght

func SecurePassword

func SecurePassword(s string) (string, error)

Generate bcrypt password value

func SetCookie

func SetCookie(w http.ResponseWriter, name, value string)

SetCookie - writing new cookie to web response

func UserConflict

func UserConflict(err error) bool

UserConflict - checking the sql error for unique violation of username

Types

This section is empty.

Jump to

Keyboard shortcuts

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