Documentation ¶
Index ¶
- func ComparePassword(hashedPassword, password string) bool
- func GenerateShaToken(value string) string
- func HashPassword(password string) (string, error)
- func MultiErrors(errs ...error) error
- func Ptr[T any](v T) *T
- func Round[T float32 | float64](value T, precision int) T
- type ErrorList
- type HttpError
- type MultiError
- func (m *MultiError) Add(err error) bool
- func (m *MultiError) Err() error
- func (m *MultiError) Error() string
- func (m *MultiError) ErrorStrings() []string
- func (m *MultiError) Errors() (errs []error)
- func (m *MultiError) Is(err error) bool
- func (m *MultiError) Reset()
- func (m *MultiError) Unwrap() []error
- type MultiErrorer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComparePassword ¶
func GenerateShaToken ¶
func HashPassword ¶
func MultiErrors ¶
MultiErrors creates a MultiError and adds all errs to it and returns the resulting error.
Types ¶
type ErrorList ¶
type ErrorList []error
ErrorList is a JSON that can serialise a list of errors
func (*ErrorList) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface
func (*ErrorList) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface
type MultiError ¶
type MultiError struct {
// contains filtered or unexported fields
}
MultiError is an error type which allows multiple errors to be added and returned as single error. This is useful in the case where errors aren't fatal, and you want the combination to be returned at a later date.
func (*MultiError) Add ¶
func (m *MultiError) Add(err error) bool
Add adds the given error if it's not nil and returns true, otherwise it returns false.
func (*MultiError) Err ¶
func (m *MultiError) Err() error
Err returns either: * nil - if no errors where added * the added error - if only one error was added * itself - otherwise
func (*MultiError) ErrorStrings ¶
func (m *MultiError) ErrorStrings() []string
ErrorStrings returns a string array of errors
func (*MultiError) Errors ¶
func (m *MultiError) Errors() (errs []error)
Errors returns a flattened list of all errors the MultiError contains
func (*MultiError) Is ¶
func (m *MultiError) Is(err error) bool
func (*MultiError) Unwrap ¶
func (m *MultiError) Unwrap() []error
Unwrap allows errors.Is to unwrap a MultiError's list of errors
type MultiErrorer ¶
type MultiErrorer interface {
Errors() []error
}
MultiErrorer is an interface that defines objects that returns multiple errors