https

package
v0.1.1-pprof-3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CTXHandlerKey = "_CTX_Handler"
)
View Source
const (
	CodeOk = 20000
)
View Source
const (
	CtxResponseKey = "_CTX_RESPONSE"
)
View Source
const (
	HTTPHeaderFrom = "X-SP-METADATA-HTTP-FROM"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Code    int        `json:"code"`
	Message string     `json:"message"`
	Errors  []SubError `json:"errors,omitempty"`
}

func NewBadRequestError

func NewBadRequestError(format string, a ...any) *Error

func NewError

func NewError(code int, message string) *Error

func NewInternalError

func NewInternalError(format string, a ...any) *Error

func NewNotFoundError

func NewNotFoundError(format string, a ...any) *Error

func (*Error) Error

func (e *Error) Error() string

type Handler

type Handler func(*gin.Context) (resp interface{}, err *Error)

func (Handler) Handler

func (h Handler) Handler() Handler

func (Handler) MethodName

func (h Handler) MethodName() string

type IHandler

type IHandler interface {
	Handler() Handler
	MethodName() string
}

type Response

type Response struct {
	Error *Error      `json:"error,omitempty"`
	Data  interface{} `json:"data,omitempty"`
}

https://google.github.io/styleguide/jsoncstyleguide.xml#JSON_Structure_&_Reserved_Property_Names

type RouterGroup

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

func NewRouterGroup

func NewRouterGroup(ginGR *gin.RouterGroup) *RouterGroup

func (*RouterGroup) GET

func (rg *RouterGroup) GET(relativePath string, handler IHandler)

func (*RouterGroup) Group

func (rg *RouterGroup) Group(relativePath string, handlers ...gin.HandlerFunc) *RouterGroup

type SubError

type SubError struct {
	Domain  string `json:"domain"`
	Reason  string `json:"reason"`
	Message string `json:"message"`
}

Jump to

Keyboard shortcuts

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