bff

package
v0.0.0-...-41aba7b Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeSuccess                = 0
	CodeVersionError           = 1
	CodeUpdating               = 101
	CodeNotFound               = 1000
	CodeRequestUrlParamError   = 1001
	CodeRequestQueryParamError = 1002
	CodeRequestBodyError       = 1004
	CodeNotLogin               = 1005
	CodeServerError            = 1006
	CodeNotAllow               = 1007
	CodeUnknownError           = 1008
)

service inner error code list

Variables

This section is empty.

Functions

func CodeIter

func CodeIter(fn func(key int, value string) bool)

func Engine

func Engine() *gin.RouterGroup

func GetMessage

func GetMessage(code int) string

func HttpHandleFunc

func HttpHandleFunc(fn BbfHandlerFunc) gin.HandlerFunc

func HttpHandler

func HttpHandler(handler BbfHandler) gin.HandlerFunc

func Main

func Main() error

func MergeCodes

func MergeCodes(codes Codes)

请在初始化阶段使用该函数,运行时使用该函数可能导致同步问题

func MetricsMiddleWare

func MetricsMiddleWare() func(ctx *gin.Context)

func MockEngine

func MockEngine() *gin.Engine

func RegisterBeforeAppExitHook

func RegisterBeforeAppExitHook(opts ...func() error)

func RegisterBeforeAppRunHook

func RegisterBeforeAppRunHook(opts ...func() error)

func RequestTraceMiddle

func RequestTraceMiddle(failOut map[string]interface{}, ignore ...string) gin.HandlerFunc

func RootEngine

func RootEngine() *gin.Engine

Types

type BbfHandler

type BbfHandler func(state *State)

type BbfHandlerFunc

type BbfHandlerFunc func(state *State) (interface{}, int, error)

type Codes

type Codes map[int]string

type State

type State struct {
	*neon.Session
	logger.Logger
	Gin *gin.Context
	// contains filtered or unexported fields
}

func NewState

func NewState(ctx *gin.Context) *State

func (*State) AsyncGrpcCtx

func (m *State) AsyncGrpcCtx() context.Context

func (*State) Context

func (m *State) Context() context.Context

func (*State) Error

func (m *State) Error(code int, err error)

func (*State) ErrorMessage

func (m *State) ErrorMessage(code int, txt string)

func (*State) GrpcClientCtx

func (m *State) GrpcClientCtx() context.Context

func (*State) Json

func (m *State) Json(code int, v interface{}, err ...error)

func (*State) ShouldBindJSON

func (m *State) ShouldBindJSON(v interface{}) error

func (*State) Success

func (m *State) Success(v interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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