Documentation
¶
Index ¶
- Variables
- func CheapCompareHash(input string, hash string) bool
- func CheapHash(input string) string
- func CompareHash(password string, hashedPassword string) bool
- func EmptyIfNil[T any](input []T) []T
- func GetSecureRandomBytes(length int) []byte
- func HandleHttpError(w http.ResponseWriter, err error)
- func HashPassword(password string) string
- func JsonMergePatch(base map[string]any, patch map[string]any) map[string]any
- func MapPtr[TIn any, TOut any](v *TIn, mapping func(TIn) TOut) *TOut
- func MapSlice[T any, R any](input []T, fn func(T) R) []R
- func NilIfZero[T comparable](v T) *T
- func PanicOnError(f func() error, msg string)
- func Ptr[T any](v T) *T
- func TrimSpace(s *string) *string
- func TypeOf[T any]() reflect.Type
- func Unwrap[T any](t T, err error) T
- func ValidateDto(s any) error
- func Zero[T any]() T
- func ZeroIfNil[T comparable](v *T) T
- type SplitToken
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrApplicationNotFound = fmt.Errorf("application: %w", ErrHttpNotFound)
View Source
var ErrCredentialNotFound = fmt.Errorf("credential: %w", ErrHttpNotFound)
View Source
var (
ErrDecodingToken = errors.New("error decoding token")
)
View Source
var ErrFileNotFoud = fmt.Errorf("file: %w", ErrHttpNotFound)
View Source
var ErrGroupNotFound = fmt.Errorf("group: %w", ErrHttpNotFound)
View Source
var ErrHttpBadRequest = errors.New("bad request")
View Source
var ErrHttpConflict = errors.New("conflict")
View Source
var ErrHttpNotFound = errors.New("not found")
View Source
var ErrInvalidUuid = fmt.Errorf("invalid uuid: %w", ErrHttpBadRequest)
View Source
var ErrPasswordRuleNotFound = fmt.Errorf("password rule: %w", ErrHttpNotFound)
View Source
var ErrProjectNotFound = fmt.Errorf("project: %w", ErrHttpNotFound)
View Source
var ErrRegistrationNotEnabled = fmt.Errorf("registration is not enabled: %w", ErrHttpBadRequest)
View Source
var ErrResourceServerNotFound = fmt.Errorf("resource server: %w", ErrHttpNotFound)
View Source
var ErrResourceServerScopeNotFound = fmt.Errorf("resource server scope: %w", ErrHttpNotFound)
View Source
var ErrRoleNotFound = fmt.Errorf("role: %w", ErrHttpNotFound)
View Source
var ErrSessionNotFound = fmt.Errorf("session: %w", ErrHttpNotFound)
View Source
var ErrTemplateNotFound = fmt.Errorf("template: %w", ErrHttpNotFound)
View Source
var ErrUserApplicationMetadataNotFound = fmt.Errorf("user application metadata: %w", ErrHttpNotFound)
View Source
var ErrUserNotFound = fmt.Errorf("user: %w", ErrHttpNotFound)
View Source
var ErrVirtualServerNotFound = fmt.Errorf("virtual server: %w", ErrHttpNotFound)
Functions ¶
func CheapCompareHash ¶
func CompareHash ¶
func EmptyIfNil ¶
func EmptyIfNil[T any](input []T) []T
func GetSecureRandomBytes ¶
func HandleHttpError ¶
func HandleHttpError(w http.ResponseWriter, err error)
func HashPassword ¶
func NilIfZero ¶
func NilIfZero[T comparable](v T) *T
func PanicOnError ¶
func Unwrap ¶
Unwrap returns the value t if err is nil, otherwise it panics. This helper is intended for use in test scenarios or one-off scripts where immediate failure is desired on error. Do not use in production code.
func ValidateDto ¶
func ZeroIfNil ¶
func ZeroIfNil[T comparable](v *T) T
Types ¶
type SplitToken ¶
type SplitToken struct {
// contains filtered or unexported fields
}
func DecodeSplitToken ¶
func DecodeSplitToken(base64Token string) (SplitToken, error)
func NewSplitToken ¶
func NewSplitToken(id string, secret string) SplitToken
func (*SplitToken) Encode ¶
func (t *SplitToken) Encode() string
func (*SplitToken) Id ¶
func (t *SplitToken) Id() string
func (*SplitToken) Secret ¶
func (t *SplitToken) Secret() string
Click to show internal directories.
Click to hide internal directories.