runfunc

package
v0.0.0-...-04b0b85 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicAuth

type BasicAuth struct {
	Username string
	Password string
}

type Func

type Func func(Param) error

func GetFunc

func GetFunc(url string, option *GetFuncOption) Func

type GetFuncOption

type GetFuncOption struct {
	BasicAuth *BasicAuth
}

type Param

type Param interface {
	Request(r *http.Request, options *RequestOptions) (Response, error)
	// Start at 0, range is [0, RunnerGroup.Number)
	ID() int
	// Start at 0, each group has its own iteration.
	Iter() int
	// Report an error,
	// metricType is used to identify a type of errors.
	AddErrorMetric(err error, metricType string)
	// Report a metric point.
	AddMetric(*metric.Metric)
}

type RequestOptions

type RequestOptions struct {
	// Used to identify a type of requests,
	// If don't set type, default set to request's URL.
	MetricType string
}

type Response

type Response interface {
	// Resp.body is closed.
	Resp() *http.Response

	Body() []byte
}

Jump to

Keyboard shortcuts

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