Documentation
¶
Index ¶
- Constants
- func GetMapValues[K comparable, V comparable](m map[K]V) []V
- func IsWithinRange(v1 any, v2 any, rangeVal float64) bool
- func Normalize(value string) string
- func ToFloat64(value any) *float64
- type CompositeFileConfig
- type Configuration
- type Error
- func NewAlreadyExistsError(format string, args ...any) Error
- func NewIOError(format string, args ...any) Error
- func NewIllegalArgumentError(format string, args ...any) Error
- func NewIllegalStateError(format string, args ...any) Error
- func NewInternalError(format string, args ...any) Error
- func NewNotFoundError(format string, args ...any) Error
- func NewSvcUnavailableError(format string, args ...any) Error
- func NewSysConfigError(format string, args ...any) Error
- func NewValidationError(format string, args ...any) Error
- type ErrorBuilder
- func BuildAlreadyExistsError() *ErrorBuilder
- func BuildIOError() *ErrorBuilder
- func BuildIllegalArgumentError() *ErrorBuilder
- func BuildIllegalStateError() *ErrorBuilder
- func BuildInternalError() *ErrorBuilder
- func BuildNotFoundError() *ErrorBuilder
- func BuildSvcUnavailableError() *ErrorBuilder
- func BuildSysConfigError() *ErrorBuilder
- func BuildValidationError() *ErrorBuilder
- func NewErrorBuilder(code ErrorCode, codeValue string) *ErrorBuilder
- func NewErrorBuilderWithFactory(code ErrorCode, codeValue string, fn func(impl *ErrorImpl) Error) *ErrorBuilder
- type ErrorCode
- type ErrorImpl
- func (e *ErrorImpl) Cause() error
- func (e *ErrorImpl) Code() ErrorCode
- func (e *ErrorImpl) CodeValue() string
- func (e *ErrorImpl) Context() string
- func (e *ErrorImpl) Error() string
- func (e *ErrorImpl) Metadata() map[string]string
- func (e *ErrorImpl) MetadataValue(key string) string
- func (e *ErrorImpl) SetContext(ctx string)
- type FileConfig
- type Number
- type Triple
- type Tuple
Constants ¶
const AlreadyExistsErrorCodeValue string = "already-exists"
const IOErrorCodeValue string = "io"
const IllegalArgumentErrorCodeValue string = "illegal-argument"
const IllegalStateErrorCodeValue string = "illegal-state"
const InternalErrorCodeValue string = "internal"
const NotFoundErrorCodeValue string = "not-found"
const SystemConfigurationErrorCodeValue string = "system-configuration"
const ValidationErrorCodeValue string = "validation"
Variables ¶
This section is empty.
Functions ¶
func GetMapValues ¶
func GetMapValues[K comparable, V comparable](m map[K]V) []V
GetMapValues returns a slice of the specified maps values
func IsWithinRange ¶
IsWithinRange returns true if the two values fall within the given rangeVal
Types ¶
type CompositeFileConfig ¶
type CompositeFileConfig struct {
}
CompositeFileConfig a file configuration that delegates to a list of file configurations, and returns the first match
type Configuration ¶
type Configuration struct {
// contains filtered or unexported fields
}
func NewConfiguration ¶
func NewConfiguration() *Configuration
type Error ¶
type Error interface {
error
Code() ErrorCode
CodeValue() string
Cause() error
Context() string
SetContext(string)
MetadataValue(string) string
Metadata() map[string]string
}
Error interface describes an application error
func NewAlreadyExistsError ¶
func NewIOError ¶
func NewIllegalArgumentError ¶
func NewIllegalStateError ¶
func NewInternalError ¶
func NewNotFoundError ¶
func NewSvcUnavailableError ¶
func NewSysConfigError ¶
func NewValidationError ¶
type ErrorBuilder ¶
type ErrorBuilder struct {
// contains filtered or unexported fields
}
ErrorBuilder builds an Error
func BuildAlreadyExistsError ¶
func BuildAlreadyExistsError() *ErrorBuilder
func BuildIOError ¶
func BuildIOError() *ErrorBuilder
func BuildIllegalArgumentError ¶
func BuildIllegalArgumentError() *ErrorBuilder
func BuildIllegalStateError ¶
func BuildIllegalStateError() *ErrorBuilder
func BuildInternalError ¶
func BuildInternalError() *ErrorBuilder
func BuildNotFoundError ¶
func BuildNotFoundError() *ErrorBuilder
func BuildSvcUnavailableError ¶
func BuildSvcUnavailableError() *ErrorBuilder
func BuildSysConfigError ¶
func BuildSysConfigError() *ErrorBuilder
func BuildValidationError ¶
func BuildValidationError() *ErrorBuilder
func NewErrorBuilder ¶
func NewErrorBuilder(code ErrorCode, codeValue string) *ErrorBuilder
NewErrorBuilder creates a new ErrorBuilder
func NewErrorBuilderWithFactory ¶
func NewErrorBuilderWithFactory(code ErrorCode, codeValue string, fn func(impl *ErrorImpl) Error) *ErrorBuilder
NewErrorBuilderWithFactory creates a new ErrorBuilder
func (*ErrorBuilder) Cause ¶
func (b *ErrorBuilder) Cause(err error) *ErrorBuilder
Cause sets the optional error that caused this error
func (*ErrorBuilder) Context ¶
func (b *ErrorBuilder) Context(context string) *ErrorBuilder
Context sets a contextual string that defines the operation in-process when the error occurred
func (*ErrorBuilder) Msg ¶
func (b *ErrorBuilder) Msg(msg string) Error
Msg sets the message for the Error and creates it
func (*ErrorBuilder) Msgf ¶
func (b *ErrorBuilder) Msgf(format string, args ...any) Error
Msgf sets the message for the Error using message formatting and creates it
func (*ErrorBuilder) Str ¶
func (b *ErrorBuilder) Str(key string, val string) *ErrorBuilder
Str sets a string key and value to the metadata associated with this error
type ErrorCode ¶
type ErrorCode uint8
const AlreadyExistsErrorCode ErrorCode = 8
AlreadyExistsErrorCode related to an operation that tries to create an entity that already exists in the system
const IOErrorCode ErrorCode = 9
IOErrorCode relates to an error while trying to interface with a stream of bytes
const IllegalArgumentErrorCode ErrorCode = 4
IllegalArgumentErrorCode relates to an internal server error that means an internal argument check failed. This type of error usually signifies a bug in the software
const IllegalStateErrorCode ErrorCode = 6
IllegalStateErrorCode relates to a client level error that signifies the operation asked of the server cannot be performed because it is not in the proper state
const InternalErrorCode ErrorCode = 1
InternalErrorCode relates to a general internal server error that should be avoided if a more specific one can be chosen
const NotFoundErrorCode ErrorCode = 7
NotFoundErrorCode related to an error where a referenced resource does not exist
ServiceUnavailableErrorCode signifies that either the server or one of its dependencies is not able to service the request.
const SystemConfigurationErrorCode ErrorCode = 2
SystemConfigurationErrorCode signifies a server error that keeps the server from starting. It is related to an issue that can be fixed in the software's configuration
const UnknownErrorCode ErrorCode = 0
const ValidationErrorCode ErrorCode = 5
ValidationErrorCode signifies a client level error that means the data provided by the client to the server is invalid
type ErrorImpl ¶
type ErrorImpl struct {
// contains filtered or unexported fields
}
ErrorImpl implements an Error
func (*ErrorImpl) Error ¶
Error returns a descriptor string that encapsulates all the error's metadata. This satisfies the 'error' interface
func (*ErrorImpl) MetadataValue ¶
MetadataValue returns a value from this error's metadata.
func (*ErrorImpl) SetContext ¶
SetContext identifies the context of this error
type FileConfig ¶
type Number ¶
type Number interface {
constraints.Integer | constraints.Float
}