reqwrap

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const RootURI = "_ROOT_"

RootURI TODO

View Source
const SpcKeyReplace = "_replace_"

SpcKeyReplace TODO

Variables

View Source
var DefaultRequestConfig = &RequestConfig{
	Meta: map[string]interface{}{
		"batch_id": "__UNKNOW__",
	},
}

DefaultRequestConfig TODO

View Source
var RootNetloc = netloc.New(RootURI, "", "")

RootNetloc TODO

Functions

func NetlocFromString

func NetlocFromString(s string) (*netloc.Netloc, error)

NetlocFromString TODO

Types

type MergeFunc

type MergeFunc func(*request.Request, *RequestConfig, bool)

MergeFunc TODO

type NetlocRequestConfig

type NetlocRequestConfig struct {
	Netloc *netloc.Netloc `json:"netloc"`
	Rule   *RequestConfig `json:"rule"`
}

NetlocRequestConfig TODO

type RequestConfig

type RequestConfig struct {
	Method  string                 `json:"method,omitempty"`
	Meta    map[string]interface{} `json:"meta,omitempty"`
	Headers map[string]string      `json:"headers,omitempty"`
	Cookies map[string]string      `json:"cookies,omitempty"`
	Body    string                 `json:"body,omitempty"`
}

RequestConfig TODO

type RequestWrapper

type RequestWrapper struct {
	*serv.Serv

	*sync.RWMutex
	// contains filtered or unexported fields
}

RequestWrapper TODO

func New

func New(serv *serv.Serv, client *redis.Client) *RequestWrapper

New TODO

func (*RequestWrapper) Add

func (wrapper *RequestWrapper) Add(nlc *netloc.Netloc, reqConfig *RequestConfig) (*netloc.Netloc, *RequestConfig, error)

Add TODO

func (*RequestWrapper) Cleanup

func (wrapper *RequestWrapper) Cleanup() error

Cleanup TODO

func (*RequestWrapper) Delete

func (wrapper *RequestWrapper) Delete(nlc *netloc.Netloc) (*RequestConfig, error)

Delete TODO

func (*RequestWrapper) Get

func (wrapper *RequestWrapper) Get(nlc *netloc.Netloc) (*netloc.Netloc, *RequestConfig)

Get TODO

func (*RequestWrapper) GetAll

func (wrapper *RequestWrapper) GetAll() []*NetlocRequestConfig

GetAll TODO

func (*RequestWrapper) Load

func (wrapper *RequestWrapper) Load() error

Load TODO

func (*RequestWrapper) MatchURI

func (wrapper *RequestWrapper) MatchURI(uri string) (*netloc.Netloc, *RequestConfig)

MatchURI TODO

func (*RequestWrapper) Merge

func (wrapper *RequestWrapper) Merge(req *request.Request, reqConfig *RequestConfig, force bool)

Merge TODO

func (*RequestWrapper) OnStart

func (wrapper *RequestWrapper) OnStart(context.Context) error

OnStart TODO

func (*RequestWrapper) OnStop

func (wrapper *RequestWrapper) OnStop(context.Context) error

OnStop TODO

func (*RequestWrapper) Wrap

func (wrapper *RequestWrapper) Wrap(req *request.Request) (*netloc.Netloc, *RequestConfig)

Wrap TODO

Jump to

Keyboard shortcuts

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