extractor

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct{}

Context extract value from the the context of the request.

func (Context) Extract

func (c Context) Extract(req *http.Request, _ http.ResponseWriter, valueOfTag string) (interface{}, error)

Extract value from the context of the request.

func (Context) Tag

func (c Context) Tag() string

Tag return the tag name of this extractor.

type Header struct{}

Header allows to obtain a value from the header of the request.

func (Header) Extract

func (h Header) Extract(req *http.Request, _ http.ResponseWriter, valueOfTag string) ([]string, error)

Extract header from the http request.

func (Header) Tag

func (h Header) Tag() string

Tag return the tag name of this extractor.

type Path

type Path struct{}

Path extract value from the chi router.

func (Path) Extract

func (p Path) Extract(req *http.Request, _ http.ResponseWriter, valueOfTag string) ([]string, error)

Extract value from the chi router.

func (Path) Tag

func (p Path) Tag() string

Tag return the tag name of this extractor.

type Query

type Query struct{}

Query allows to obtain a value from the query params of the request.

func (Query) Extract

func (q Query) Extract(req *http.Request, _ http.ResponseWriter, valueOfTag string) ([]string, error)

Extract query params from the http request.

func (Query) Tag

func (q Query) Tag() string

Tag return the tag name of this extractor.

type Strings

type Strings interface {
	Extract(req *http.Request, res http.ResponseWriter, valueOfTag string) ([]string, error)
	Tag() string
}

Strings extract multiples strings values from request/response.

type Value

type Value interface {
	Extract(req *http.Request, res http.ResponseWriter, valueOfTag string) (interface{}, error)
	Tag() string
}

Value extract one value (a type) from http request/response.

Jump to

Keyboard shortcuts

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