troublemaker

package
v0.0.0-...-8f7c90a Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromValidationError

func FromValidationError(err error) error

func ToSnakeCase

func ToSnakeCase(str string) string

Types

type Trouble

type Trouble struct {
	Code    codes.Code `json:"code"`
	Reason  string     `json:"reason"`
	Message string     `json:"message"`
}

type TroubleMaker

type TroubleMaker interface {
	NewTrouble(reason string) error
}

func NewTroubleMaker

func NewTroubleMaker(setters ...TroubleMakerSetter) TroubleMaker

type TroubleMakerImpl

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

func (*TroubleMakerImpl) NewTrouble

func (tmi *TroubleMakerImpl) NewTrouble(reason string) error

type TroubleMakerSetter

type TroubleMakerSetter func(*TroubleMakerImpl)

func WithCodes

func WithCodes(codes map[string]codes.Code) TroubleMakerSetter

func WithMessages

func WithMessages(messages map[string]string) TroubleMakerSetter

type ValidationError

type ValidationError interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
}

type ValidationMultiError

type ValidationMultiError interface {
	Error() string
	AllErrors() []error
}

Jump to

Keyboard shortcuts

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