queryer

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MultiOpQueryer

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

MultiOpQueryer is a queryer that will batch subsequent query on some interval into a single network request to a single target

func NewMultiOpQueryer

func NewMultiOpQueryer(url string, maxBatchSize int) *MultiOpQueryer

NewMultiOpQueryer returns a MultiOpQueryer with the provided parameters

func (*MultiOpQueryer) Query

func (q *MultiOpQueryer) Query(inputs []*requests.Request) ([]map[string]interface{}, error)

func (*MultiOpQueryer) Subscribe added in v0.2.0

func (q *MultiOpQueryer) Subscribe(req *requests.Request, closeCh <-chan struct{}, resCh chan *requests.Response) error

func (*MultiOpQueryer) URL

func (q *MultiOpQueryer) URL() string

func (*MultiOpQueryer) WithContext

func (q *MultiOpQueryer) WithContext(ctx context.Context) *MultiOpQueryer

WithContext sets ctx which will be passed to following http.Request

func (*MultiOpQueryer) WithHTTPClient

func (q *MultiOpQueryer) WithHTTPClient(client *http.Client) *MultiOpQueryer

WithHTTPClient lets the user configure the client to use when making network requests

func (*MultiOpQueryer) WithMiddlewares

func (q *MultiOpQueryer) WithMiddlewares(mwares []RequestMiddleware) *MultiOpQueryer

WithMiddlewares lets the user assign middlewares to the queryer

type Queryer

type Queryer interface {
	Query([]*requests.Request) ([]map[string]interface{}, error)
	Subscribe(*requests.Request, <-chan struct{}, chan *requests.Response) error
	URL() string
}

type RequestMiddleware

type RequestMiddleware func(*http.Request) error

RequestMiddleware are functions can be passed to Queryer to affect its internal behavior

type UploadMap

type UploadMap []*UploadMapItem

func (*UploadMap) Add

func (u *UploadMap) Add(upload *requests.Upload, varName string)

func (UploadMap) Empty

func (u UploadMap) Empty() bool

func (UploadMap) Map

func (u UploadMap) Map() map[string][]string

type UploadMapItem

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

Jump to

Keyboard shortcuts

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