Documentation
¶
Overview ¶
spell-checker: disable
spell-checker: disable
spell-checker: disable
Index ¶
- func Fuse(restfulPort, grpcPort int, autoRecover bool, withErr bool, ...)
- func Fuse2(restfulPort, grpcPort int, autoRecover bool, withErr bool, ...)
- func SetFuseStatusMessage(call func(status *FuseDefaultStatus, message *FuseDefaultMessage))
- type ClientFuseGRPC
- type FuseContext
- type FuseContextRequest
- type FuseDefaultMessage
- type FuseDefaultStatus
- type FuseOpt
- type FuseResponse
- type FuseResponseMeta
- type FuseRouter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fuse ¶
func Fuse(restfulPort, grpcPort int, autoRecover bool, withErr bool, routes func(router FuseRouter))
func SetFuseStatusMessage ¶
func SetFuseStatusMessage(call func(status *FuseDefaultStatus, message *FuseDefaultMessage))
Types ¶
type ClientFuseGRPC ¶
type ClientFuseGRPC interface {
Restful(path string, header map[string]string, payload map[string]interface{}, params map[string]string) (*grf.Response, error)
}
func ConnectFuseGRPC ¶
func ConnectFuseGRPC(address string) (ClientFuseGRPC, error)
type FuseContext ¶
type FuseContext interface {
URI() string
Request() FuseContextRequest
Params(key string, defaultValue ...string) string
Query(key string, defaultValue ...string) string
Parser(logc *clog.Instance, header, body interface{}) (bool, error)
GetMultipartFiles() map[string][]*multipart.FileHeader
ClientIP() string
Path() string
Method() string
AuthX() interface{}
AuthY() interface{}
AuthZ() interface{}
SetAuth(authX, authY, authZ interface{})
SetCLog(logc *clog.Instance)
GetCLog() *clog.Instance
GetResCode() (int, string)
GetResObject() interface{}
SetResponse(code int, subCode string, obj interface{}) error
SR200OK(subCode string, obj interface{}) error
SR400BadRequest(subCode string, obj interface{}) error
SR403Forbidden(subCode string, obj interface{}) error
SR404NotFound(subCode string, obj interface{}) error
SR406NotAcceptable(subCode string, obj interface{}) error
SR428PreconditionRequired(subCode string, obj interface{}) error
SR500InternalServerError(subCode string, obj interface{}) error
RString(logc *clog.Instance, code int, data string) error
RJson(logc *clog.Instance, code int, data interface{}, opt ...FuseOpt) error
RJsonRaw(logc *clog.Instance, code int, data []byte) error
Redirect(logc *clog.Instance, code int, url string) error
RXXX(logc *clog.Instance, code int, status string, data interface{}, opt ...FuseOpt) error
R200OK(logc *clog.Instance, data interface{}, opt ...FuseOpt) error
R400BadRequest(logc *clog.Instance, message string, opt ...FuseOpt) error
R403Forbidden(logc *clog.Instance, message string, opt ...FuseOpt) error
R404NotFound(logc *clog.Instance, message string, opt ...FuseOpt) error
R406NotAcceptable(logc *clog.Instance, message string, opt ...FuseOpt) error
R428PreconditionRequired(logc *clog.Instance, message string, opt ...FuseOpt) error
R500InternalServerError(logc *clog.Instance, err error, opt ...FuseOpt) error
SetSendResponse(send bool)
GetUnSendResponse() *FuseResponse
GetUnSendResponseOpt() []FuseOpt
}
type FuseContextRequest ¶ added in v1.1.16
type FuseDefaultMessage ¶
type FuseDefaultStatus ¶
type FuseOpt ¶
type FuseOpt struct {
SubCode string
Status string
Message string
Address string
Error error
MetaData interface{}
Data interface{}
NewMeta map[string]interface{}
NewHeader map[string]interface{}
LogMessage string
LogData string
LogDepthAdd int
JsonCustomOutput bool
StringCustomOutput bool
// contains filtered or unexported fields
}
type FuseResponse ¶ added in v1.1.48
type FuseResponse struct {
Meta FuseResponseMeta `json:"meta"`
Data interface{} `json:"data,omitempty"`
}
type FuseResponseMeta ¶ added in v1.1.48
type FuseResponseMeta struct {
Code int `json:"code"`
SubCode string `json:"subcode,omitempty"`
Status string `json:"status,omitempty"`
Message string `json:"message,omitempty"`
Address string `json:"address,omitempty"`
Error string `json:"error,omitempty"`
Data interface{} `json:"data,omitempty"`
}
type FuseRouter ¶
type FuseRouter interface {
Unrouted(handler func(ctx FuseContext, method, path, url string) error)
Single(path string, handlers ...func(sc FuseContext) error)
Group(endpoints map[string][]func(sc FuseContext) error)
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.