server

package
v1.1.14 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 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 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, defaultValue ...string) string
	Query(key string, defaultValue ...string) string
	Parser(cli *clog.Instance, header, body interface{}) (bool, error)
	ClientIP() string
	Path() string
	Method() string

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

	R200OK(cli *clog.Instance, data interface{}, opt ...FuseOpt) error
	R400BadRequest(cli *clog.Instance, message string, opt ...FuseOpt) error
	R401Unauthorized(cli *clog.Instance, message string, opt ...FuseOpt) error
	R403Forbidden(cli *clog.Instance, message string, opt ...FuseOpt) error
	R404NotFound(cli *clog.Instance, message string, opt ...FuseOpt) error
	R406NotAcceptable(cli *clog.Instance, message string, opt ...FuseOpt) error
	R428PreconditionRequired(cli *clog.Instance, message string, opt ...FuseOpt) error
	R500InternalServerError(cli *clog.Instance, 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{}
	NewMeta    map[string]interface{}
	NewHeader  map[string]interface{}
	LogMessage string
	LogData    string
	// 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