buffon

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2021 License: MIT Imports: 14 Imported by: 0

README

buffon

Build Status Coverage Status GoDoc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregator

type Aggregator struct {
	C Executor
}

func NewAggregator

func NewAggregator(c Executor) *Aggregator

func (*Aggregator) ServeHTTP

func (a *Aggregator) ServeHTTP(w http.ResponseWriter, r *http.Request)

type DefaultExecutor

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

func NewDefaultExecutor

func NewDefaultExecutor(s string, opt *DefaultOption) (*DefaultExecutor, error)

func (*DefaultExecutor) Build

func (c *DefaultExecutor) Build(r *http.Request) (map[string]*http.Request, error)

func (*DefaultExecutor) Fetch

func (c *DefaultExecutor) Fetch(mr map[string]*http.Request) (map[string]*http.Response, error)

func (*DefaultExecutor) Finish

func (c *DefaultExecutor) Finish(w http.ResponseWriter, ms map[string]*http.Response, err error)

func (*DefaultExecutor) FinishErr

func (c *DefaultExecutor) FinishErr(w http.ResponseWriter, code int, err error)

type DefaultOption

type DefaultOption struct {
	Transport    http.RoundTripper
	Timeout      time.Duration
	MaxTimeout   time.Duration
	MaxRequest   int
	FetchLatency func(n time.Duration, method, routePattern string, statusCode int)
	FetchLogger  func(n time.Duration, method, urlPath string, statusCode int, reqID string)
	FetchFilter  func(method, urlPath string) bool
}

type Error

type Error struct {
	Path       string `json:"-"`
	Method     string `json:"-"`
	Message    string `json:"message"`
	StatusCode int    `json:"-"`
	ErrCode    int    `json:"code"`
	ErrTimeout bool   `json:"-"`
}

func (Error) Error

func (err Error) Error() string

type ErrorMulti

type ErrorMulti map[string]error

func (ErrorMulti) Error

func (mrr ErrorMulti) Error() string

type Executor

type Executor interface {
	Build(r *http.Request) (map[string]*http.Request, error)
	Fetch(mr map[string]*http.Request) (map[string]*http.Response, error)
	Finish(w http.ResponseWriter, mr map[string]*http.Response, err error)
	FinishErr(w http.ResponseWriter, code int, err error)
}

Jump to

Keyboard shortcuts

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