utils

package
v0.0.0-...-3122bcc Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHash256 = myerrors.NewErrorInternal("Ошибка хеширования")
View Source
var MessageErrWrongNumberParam = "Получили некорректный числовой параметр. " +
	"Он должен быть целым"

Functions

func AddQueryParamsToRequest

func AddQueryParamsToRequest(r *http.Request, params map[string]string)

func CamelToSnakeCase

func CamelToSnakeCase(str string) string

func ComparePassAndHash

func ComparePassAndHash(passHash []byte, plainPassword string) bool

func CompareSameType

func CompareSameType[T comparable](received T, expected T) error

func EqualError

func EqualError(received error, expected error) error

func EqualTest

func EqualTest(received any, expected any) error

EqualTest accept arguments that should be work with json.Marshal.

func Hash256

func Hash256(content []byte) (string, error)

func HashPass

func HashPass(plainPassword string) (string, error)

func NullFloat64ToUnsafeFloat

func NullFloat64ToUnsafeFloat(nullFloat64 sql.NullFloat64) *float64

func NullInt64ToUnsafeUint

func NullInt64ToUnsafeUint(nullInt64 sql.NullInt64) *uint64

func NullStringToUnsafe

func NullStringToUnsafe(nullStr sql.NullString) *string

func NullTimeToUnsafe

func NullTimeToUnsafe(nullTime sql.NullTime) *time.Time

func ParseStringFromRequest

func ParseStringFromRequest(r *http.Request, paramName string) string

func ParseUint64FromRequest

func ParseUint64FromRequest(r *http.Request, paramName string) (uint64, error)

func SimplifyPath

func SimplifyPath(path string) string

func SnakeToCamelCase

func SnakeToCamelCase(str string) string

func StructToMap

func StructToMap(data interface{}) map[string]interface{}

func UnsafeFloat64ToNullFloat

func UnsafeFloat64ToNullFloat(unsafeFloat64 *float64) sql.NullFloat64

func UnsafeStringToNull

func UnsafeStringToNull(str *string) sql.NullString

func UnsafeTimeToNull

func UnsafeTimeToNull(time *time.Time) sql.NullTime

func UnsafeUint64ToNullInt

func UnsafeUint64ToNullInt(unsafeInt64 *uint64) sql.NullInt64

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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