response

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorWithMessage

func ErrorWithMessage(ctx *gin.Context, message string)

ErrorWithMessage gin response with message

func GinError

func GinError(ctx *gin.Context, err error)

GinError gin response with format err

Types

type Code

type Code interface {
	Status() int
	Value() string
}

type ProxyCode

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

func (*ProxyCode) Status

func (p *ProxyCode) Status() int

func (*ProxyCode) Value

func (p *ProxyCode) Value() string

type ProxyError

type ProxyError struct {
	Code    Code   `json:"code"`
	Message string `json:"message"`
}

func Error

func Error(code interface{}, message string) *ProxyError

Error according to the given message structure returns an ProxyError

func ErrorWith

func ErrorWith(code interface{}, err error) *ProxyError

ErrorWith according to the given error structure returns an ProxyError

func ErrorWiths

func ErrorWiths(code interface{}, message string, err error) *ProxyError

ErrorWiths according to the given message and error structure returns an ProxyError

func (*ProxyError) Error

func (p *ProxyError) Error() string

type Response

type Response struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

Jump to

Keyboard shortcuts

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