server

package
v1.1.49 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

spell-checker: disable

spell-checker: disable

spell-checker: disable

Index

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 Fuse2 added in v1.1.37

func Fuse2(restfulPort, grpcPort int, autoRecover bool, withErr bool, routes func(router FuseRouter), grpcRegister ...func(svc *grpc.Server))

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 {
	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

	RString(logc *clog.Instance, code int, data string) error
	RJson(logc *clog.Instance, code int, data interface{}) error
	RJsonRaw(logc *clog.Instance, code int, data []byte) error
	R200OK(logc *clog.Instance, data interface{}, opt ...FuseOpt) error
	R400BadRequest(logc *clog.Instance, message string, opt ...FuseOpt) error
	R401Unauthorized(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 FuseContextRequest interface {
	Body() []byte
	Header() map[string]string
	SetHeader(key, value string)
}

type FuseDefaultMessage

type FuseDefaultMessage struct {
	R400BadRequest           string
	R401Unauthorized         string
	R403Forbidden            string
	R404NotFound             string
	R406NotAcceptable        string
	R428PreconditionRequired string
	R500InternalServerError  string
}

type FuseDefaultStatus

type FuseDefaultStatus struct {
	R200OK                   string
	R400BadRequest           string
	R401Unauthorized         string
	R403Forbidden            string
	R404NotFound             string
	R406NotAcceptable        string
	R428PreconditionRequired string
	R500InternalServerError  string
}

type FuseOpt

type FuseOpt struct {
	Status     string
	Message    string
	Address    string
	Error      error
	MetaData   interface{}
	Data       interface{}
	NewMeta    map[string]interface{}
	NewHeader  map[string]interface{}
	LogMessage string
	LogData    string
	// 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"`
	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 {
	Single(path string, handlers ...func(sc FuseContext) error)
	Group(endpoints map[string][]func(sc FuseContext) error)
}

Directories

Path Synopsis
proto

Jump to

Keyboard shortcuts

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