utils

package
v0.0.0-...-1e50175 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareHashAndPassword

func CompareHashAndPassword(hashedPassword, plainPassword string) (matched bool, err error)

CompareHashAndPassword return nil for success, error for not matched

func Contains

func Contains[T comparable](elems []T, v T) bool

func ContainsSlice

func ContainsSlice[T comparable](slice []T, subSlice []T) bool

func CreateBucketIfMissing

func CreateBucketIfMissing(ctx context.Context, client minio.Client, bucketName string) error

func GeneratePasswordHash

func GeneratePasswordHash(plainPassword string) (hashedPassword string, err error)

func SliceMap

func SliceMap[T, U any](ts []T, f func(T) U) []U

func UintToString

func UintToString(i uint) string

func UnmarshalInterface

func UnmarshalInterface[T comparable](input interface{}, output *T) error

todo add check that incomfing value is a pointer similar to json.unmarshall todo tests with different types pointer, without pointer, pointer to pointer

Types

type Range

type Range struct {
	Start int64 // start will always be provided
	End   int64 // end = -1 if not provided
}

range is inclusive

type RangeHeader

type RangeHeader struct {
	Unit   string
	Ranges []Range
}

func ParseRangeHeader

func ParseRangeHeader(value string) (*RangeHeader, error)

type StringOrStringSlice

type StringOrStringSlice struct {
	// contains filtered or unexported fields
}

func (*StringOrStringSlice) List

func (s *StringOrStringSlice) List() []string

func (*StringOrStringSlice) UnmarshalJSON

func (s *StringOrStringSlice) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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