Documentation ¶
Overview ¶
Package batchrequest is a plugin for batch requests
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var FasthttpDo = fasthttp.Do
FasthttpDo rename the method FasthttpDo
Functions ¶
func ServerFilter ¶
func ServerFilter(ctx context.Context, _ interface{}, _ filter.ServerHandleFunc) (interface{}, error)
ServerFilter is the server-side interceptor
Types ¶
type Options ¶
type Options struct { // Name of the status code field, default is "code"; supports nested structure, e.g.: {"common":{"code":0}}, // then fill in "common.code" CodePath string `yaml:"code_path"` // Path of the "msg" field, default is "msg"; supports nested structure, e.g.: {"common":{"msg":"success"}}, // then fill in "common.msg" MsgPath string `yaml:"msg_path"` // Success status code, default is 0 SuccessCode int64 `yaml:"success_code"` // Success response body SuccessBody []byte `yaml:"-"` // List of request interfaces RequestList []*Request `yaml:"request_list"` }
Options represents the plugin configuration
type Plugin ¶
type Plugin struct { }
Plugin defines the plugin
func (*Plugin) CheckConfig ¶
CheckConfig validates the plugin configuration and returns a parsed configuration object with the correct types. Used in the ServerFilter method for parsing.
type Request ¶
type Request struct { // Name of the request interface Method string `yaml:"method"` // Path of the target data in the original response body, e.g.: {"data":{"source":{}}}, then fill in "data.source" SourceDatePath string `yaml:"source_date_path"` // Path where the target data is inserted into the result response body, e.g.: put it into {"data":{"target":{}}}, // then fill in "data.target" TargetDataPath string `yaml:"target_data_path"` // Ignore errors IgnoreErr bool `yaml:"ignore_err"` // Path of the status code in the original response, e.g.: {"common":{"code":0}}, then fill in "common.code", // default is "code" CodePath string `yaml:"code_path"` // Path of the "msg" in the original response, e.g.: {"common":{"msg":"ok"}}, then fill in "common.msg", // default is "msg" MsgPath string `yaml:"msg_path"` // Success status code in the original response, default is 0 SuccessCode int64 `yaml:"success_code"` }
Request represents the request configuration
Click to show internal directories.
Click to hide internal directories.