lib

package
v0.0.0-...-d49a382 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GeneralErrorsKey = "general_errors"
)

Variables

View Source
var (
	ErrInvalidColorValue = errors.New("rgb color value cannot be larger than 0x00FFFFFF")
)

Functions

This section is empty.

Types

type AspectRatio

type AspectRatio struct{ Width, Height uint16 }

func (AspectRatio) FloatVal

func (a AspectRatio) FloatVal() float64

func (AspectRatio) String

func (a AspectRatio) String() string

type BitFlag

type BitFlag interface {
	// Add returns the value of the current flag bitwise ORd with the given flag.
	//
	// This method will not modify the value of the current flag.
	Add(flag BitFlag) BitFlag

	// Remove returns the value of the current flag bitwise ANDed with the inverse
	// of the given flag.
	//
	// This method will not modify the value of the current flag.
	Remove(flag BitFlag) BitFlag

	// Mask returns the value of the current flag bitwise ANDed with the given
	// flag.
	Mask(flag BitFlag) BitFlag
}

type Color

type Color interface {
	json.Marshaler
	json.Unmarshaler

	RawValue() uint32
	SetRawValue(val uint32) Color

	Red() uint8
	Green() uint8
	Blue() uint8
}

func NewColor

func NewColor() Color

type ValidationErrorSet

type ValidationErrorSet interface {
	error

	json.Marshaler

	gojay.MarshalerJSONObject

	// Returns the set top level error message.
	//
	// Same as calling `.Error()`.
	Message() string

	// SetMessage sets the top level message for this error.
	//
	// This message will be returned when the `.Error()` method is called.
	SetMessage(string) ValidationErrorSet

	// AppendErrorSet appends all the errors from the given error set to this
	// error set.
	//
	// If the given error value is nil, this method does nothing.
	AppendErrorSet(err ValidationErrorSet) ValidationErrorSet

	// AppendKeyedError adds the given keyed error string to the list of field
	// specific errors.
	AppendKeyedError(key serial.Key, err string) ValidationErrorSet

	// AppendRawKeyedError adds the given keyed error to the list of field
	// specific errors.
	//
	// If the given error value is nil, this method does nothing.
	//
	// If the given error is an instance of ValidationErrorSet, this method
	// will unpack the given error set into this error set.
	AppendRawKeyedError(key serial.Key, err error) ValidationErrorSet

	// AppendGeneralError adds the given error text to the list of general, or
	// non-field specific errors.
	AppendGeneralError(err string) ValidationErrorSet

	// AppendRawError adds the given error's text value to the list of general
	// errors contained by this error set.
	//
	// If the given error value is nil, this method does nothing.
	AppendRawError(err error) ValidationErrorSet

	// GetKeyedErrors returns a map of keys (such as json field name) to a list
	// of errors relating to each key.
	//
	// General/unkeyed errors are not included in this mapping.
	GetKeyedErrors() map[string][]string

	// GetGeneralErrors returns only the unkeyed errors.
	GetGeneralErrors() []string

	// GetAllErrors returns all contained errors in a map of key to value.
	//
	// General/non-keyed errors will be available using the GeneralErrorsKey const
	// as the map key.
	GetAllErrors() map[string][]string

	// GetSize returns the number of errors contained in this error set.
	Len() uint16
}

func NewValidationErrorSet

func NewValidationErrorSet() ValidationErrorSet

Jump to

Keyboard shortcuts

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