server

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: MIT Imports: 24 Imported by: 0

Documentation

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 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 {
	Params(key string) string
	Parser(header, body interface{}) (bool, error)

	AuthX() interface{}
	AuthY() interface{}
	AuthZ() interface{}
	SetAuth(authX, authY, authZ interface{})

	R200OK(data interface{}, opt ...FuseOpt) error
	R400BadRequest(message string, opt ...FuseOpt) error
	R401Unauthorized(message string, opt ...FuseOpt) error
	R403Forbidden(message string, opt ...FuseOpt) error
	R404NotFound(message string, opt ...FuseOpt) error
	R406NotAcceptable(message string, opt ...FuseOpt) error
	R428PreconditionRequired(message string, opt ...FuseOpt) error
	R500InternalServerError(err error, opt ...FuseOpt) error
}

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{}
	// contains filtered or unexported fields
}

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