v1

package
v0.0.0-...-3d44fc7 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 25 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddController

func AddController(v interface{})

func AddInterceptor

func AddInterceptor(interceptor interceptor.Interceptor, order int)

func Register

func Register(controller *RestfulController)

Types

type BeforeDispatchCallbackFunc

type BeforeDispatchCallbackFunc func(w http.ResponseWriter, r *http.Request) bool

BeforeDispatchCallbackFunc 在进行分发前进行回调的函数, 返回true结束

type CommonResponse

type CommonResponse struct {
	RequestId string
	Code      *int        `json:",omitempty"`
	Data      interface{} `json:",omitempty"`
	Error     e.ApiError  `json:",omitempty"`
}

type Config

type Config struct {
	Name                  string     `yaml:"name" default:"default"`
	Port                  int        `yaml:"port" default:"8080"`
	ReadTimeout           int        `yaml:"read_timeout" default:"10"`
	WriteTimeout          int        `yaml:"write_timeout" default:"10"`
	RootPath              string     `yaml:"root_path"` // 可以为空
	HeaderTraceID         string     `yaml:"header_trace_id" default:"X-Request-Id"`
	ControllerRootPkgName string     `yaml:"controller_root_pkg_name" default:"controller"`
	WebLimiter            WebLimiter `yaml:"web_limiter"`
}

type HttpMetric

type HttpMetric struct {
	// contains filtered or unexported fields
}

func NewHttpMetric

func NewHttpMetric() *HttpMetric

type HttpServer

type HttpServer struct {
	// contains filtered or unexported fields
}
var DefaultHttpServer *HttpServer

func InitDefaultHttpServer

func InitDefaultHttpServer(config Config) *HttpServer

func NewHttpServer

func NewHttpServer(config Config) *HttpServer

func (*HttpServer) AddController

func (s *HttpServer) AddController(v interface{})

AddController 只能增加func、point和interface,其他类型直接忽略

func (*HttpServer) AddInterceptor

func (s *HttpServer) AddInterceptor(i interceptor.Interceptor, order int)

func (*HttpServer) Close

func (s *HttpServer) Close()

func (*HttpServer) Register

func (s *HttpServer) Register(controller *RestfulController)

Register 注册restfulController

func (*HttpServer) SetBeforeDispatchCallBack

func (s *HttpServer) SetBeforeDispatchCallBack(callbackFunc BeforeDispatchCallbackFunc)

func (*HttpServer) StartUp

func (s *HttpServer) StartUp()

type RequestCtx

type RequestCtx struct {
	// contains filtered or unexported fields
}

func (*RequestCtx) GetParams

func (c *RequestCtx) GetParams() map[string][]string

func (*RequestCtx) GetPath

func (c *RequestCtx) GetPath() string

func (*RequestCtx) GetPathParam

func (c *RequestCtx) GetPathParam() map[string]string

func (*RequestCtx) IsFinish

func (c *RequestCtx) IsFinish() bool

func (*RequestCtx) SetResponse

func (c *RequestCtx) SetResponse(v interface{})

type RestfulController

type RestfulController struct {
	// contains filtered or unexported fields
}

func NewRestFul

func NewRestFul() *RestfulController

func (*RestfulController) Action

func (c *RestfulController) Action(action string) *RestfulController

func (*RestfulController) Controller

func (c *RestfulController) Controller(controllerName string) *RestfulController

func (*RestfulController) GetPath

func (c *RestfulController) GetPath() string

func (*RestfulController) GetVersion

func (c *RestfulController) GetVersion() string

func (*RestfulController) Method

func (c *RestfulController) Method(method string) *RestfulController

func (*RestfulController) Path

func (*RestfulController) Version

func (c *RestfulController) Version(version string) *RestfulController

type ValidFunc

type ValidFunc func([]string, reflect.StructField, reflect.Value, string) error

type WebLimiter

type WebLimiter struct {
	Enable bool `yaml:"enable"`
	Qos    int  `yaml:"qos" default:"1000"`
}

Jump to

Keyboard shortcuts

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