business

package
v0.0.0-...-c3c09b5 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// common
	Unknown           = 1000
	NotFound          = 1001
	Validation        = 1002
	Internal          = 1003
	ServerUnavailable = 1004
	MethodNowAllowed  = 1005
	PathNotFound      = 1006
	TooManyRequest    = 1007

	// postgres
	PostgresInternalError = 1100

	// redis
	RedisInternalError = 1200

	// lock
	AcquireLockURLResourceError = 1300
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	HTTPStatusCode int `json:"-"`
}

type Error

type Error struct {
	Base
	BusinessCode     int               `json:"code"`
	Message          string            `json:"message"`
	ValidationErrors map[string]string `json:"validationErrors,omitempty"`
	Reason           error             `json:"-"`
}

func NewError

func NewError(businessCode int, httpStatusCode int, message string, reason error) *Error

func (*Error) Error

func (b *Error) Error() string

type Success

type Success struct {
	Base
	Response interface{} `json:",omitempty"`
}

func NewSuccess

func NewSuccess(httpStatusCode int, response interface{}) *Success

Jump to

Keyboard shortcuts

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