request

package
v2.0.0-beta3 Latest Latest
Warning

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

Go to latest
Published: May 27, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package request provides functionality for handling HTTP Requests including the insertion of configuration options into the request

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBody

func GetBody(r *http.Request) ([]byte, error)

func SetBody

func SetBody(r *http.Request, body []byte)

func SetResources

func SetResources(r *http.Request, rsc *Resources) *http.Request

SetResources will save the Resources collection to the HTTP Request's context

Types

type Resources

type Resources struct {
	sync.Mutex
	BackendOptions    *bo.Options
	PathConfig        *po.Options
	CacheConfig       *co.Options
	NoLock            bool
	CacheClient       cache.Cache
	BackendClient     backends.Backend
	AlternateCacheTTL time.Duration
	TimeRangeQuery    *timeseries.TimeRangeQuery
	Tracer            *tracing.Tracer
	IsMergeMember     bool
	RequestBody       []byte
	ResponseMergeFunc any
	TSUnmarshaler     timeseries.UnmarshalerFunc
	TSMarshaler       timeseries.MarshalWriterFunc
	TSTransformer     func(timeseries.Timeseries)
	TS                timeseries.Timeseries
	TSReqestOptions   *timeseries.RequestOptions
	Response          *http.Response
	AuthResult        *auth.AuthResult
	AlreadyEncoded    bool
}

Resources is a collection of resources a Trickster request would need to fulfill the client request This is stored in the client request's context for use by request handers.

func GetResources

func GetResources(r *http.Request) *Resources

GetResources will return a casted Resource object from the HTTP Request's context

func NewResources

func NewResources(oo *bo.Options, pathOpts *po.Options, cacheOpts *co.Options,
	c cache.Cache, client backends.Backend, t *tracing.Tracer) *Resources

NewResources returns a new Resources collection based on the provided inputs

func (*Resources) Clone

func (r *Resources) Clone() *Resources

Clone returns an exact copy of the subject Resources collection

func (*Resources) Merge

func (r *Resources) Merge(r2 *Resources)

Merge sets the configuration references in the subject resources to the source's

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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