locator

package
v0.10.6 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBody

func NewBody(opts ...Option) (kind.Locator, error)

NewBody returns body locator

func NewConstants added in v0.9.1

func NewConstants(opts ...Option) (kind.Locator, error)

NewConstants returns body locator

func NewContext

func NewContext(_ ...Option) (kind.Locator, error)

NewContext returns env locator

func NewCookie

func NewCookie(opts ...Option) (kind.Locator, error)

NewCookie returns cookie locator

func NewEnv

func NewEnv(_ ...Option) (kind.Locator, error)

NewEnv returns env locator

func NewForm

func NewForm(opts ...Option) (kind.Locator, error)

NewForm returns body locator

func NewGenerator

func NewGenerator(_ ...Option) (kind.Locator, error)

NewGenerator returns Generator locator

func NewHeader

func NewHeader(opts ...Option) (kind.Locator, error)

NewHeader returns header locator

func NewHttpRequest

func NewHttpRequest(opts ...Option) (kind.Locator, error)

NewHttpRequest returns http requestState locator

func NewObject

func NewObject(opts ...Option) (kind.Locator, error)

NewObject returns parameter locator

func NewParameter

func NewParameter(opts ...Option) (kind.Locator, error)

NewParameter returns parameter locator

func NewPath

func NewPath(opts ...Option) (kind.Locator, error)

NewPath returns path locator

func NewQuery

func NewQuery(opts ...Option) (kind.Locator, error)

NewQuery returns query locator

func NewRepeated

func NewRepeated(opts ...Option) (kind.Locator, error)

NewRepeated returns parameter locator

func NewState

func NewState(opts ...Option) (kind.Locator, error)

NewState returns state locator

func NewTransient

func NewTransient(_ ...Option) (kind.Locator, error)

NewTransient returns Transient locator

func NewView

func NewView(opts ...Option) (kind.Locator, error)

func Register

func Register(kind state.Kind, newLocator NewLocator)

Types

type Body

type Body struct {
	sync.Once
	// contains filtered or unexported fields
}

func (*Body) Names

func (r *Body) Names() []string

func (*Body) Value

func (r *Body) Value(ctx context.Context, name string) (interface{}, bool, error)

type Constants added in v0.9.1

type Constants struct {
	sync.Once
	// contains filtered or unexported fields
}

func (*Constants) Names added in v0.9.1

func (r *Constants) Names() []string

func (*Constants) Value added in v0.9.1

func (r *Constants) Value(ctx context.Context, name string) (interface{}, bool, error)

type Context

type Context struct {
}

func (*Context) Names

func (v *Context) Names() []string

func (*Context) Value

func (v *Context) Value(ctx context.Context, name string) (interface{}, bool, error)
type Cookie struct {
	// contains filtered or unexported fields
}

func (*Cookie) Names

func (v *Cookie) Names() []string

func (*Cookie) Value

func (v *Cookie) Value(ctx context.Context, name string) (interface{}, bool, error)

type DataView

type DataView struct {
	Views view.NamedViews
	ReadInto
}

func (*DataView) Names

func (p *DataView) Names() []string

func (*DataView) Value

func (p *DataView) Value(ctx context.Context, name string) (interface{}, bool, error)

type Env

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

func (*Env) Names

func (v *Env) Names() []string

func (*Env) Value

func (v *Env) Value(ctx context.Context, name string) (interface{}, bool, error)

type Form

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

func (*Form) Names

func (r *Form) Names() []string

func (*Form) Value

func (r *Form) Value(ctx context.Context, name string) (interface{}, bool, error)

type Generator

type Generator struct{}

func (*Generator) Names

func (v *Generator) Names() []string

func (*Generator) Value

func (v *Generator) Value(ctx context.Context, name string) (interface{}, bool, error)
type Header struct {
	// contains filtered or unexported fields
}

func (*Header) Names

func (q *Header) Names() []string

func (*Header) Value

func (q *Header) Value(ctx context.Context, name string) (interface{}, bool, error)

type HttpRequest

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

func (*HttpRequest) Names

func (p *HttpRequest) Names() []string

func (*HttpRequest) Value

func (p *HttpRequest) Value(ctx context.Context, name string) (interface{}, bool, error)

type KindLocator

type KindLocator struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

KindLocator represents locators

func NewKindsLocator

func NewKindsLocator(parent *KindLocator, options ...Option) *KindLocator

NewKindsLocator creates a locator

func (*KindLocator) Has

func (l *KindLocator) Has(kind state.Kind) bool

func (*KindLocator) Lookup

func (l *KindLocator) Lookup(kind state.Kind) (kind.Locator, error)

Lookup return locator for supplied kind or error

func (*KindLocator) Options added in v0.9.0

func (l *KindLocator) Options() []Option

func (*KindLocator) RemoveLocators added in v0.9.1

func (l *KindLocator) RemoveLocators(kind ...state.Kind)

func (*KindLocator) With

func (l *KindLocator) With(options ...Option) *KindLocator

With creates sub locator with options

type NewLocator

type NewLocator func(options ...Option) (kind.Locator, error)

NewLocator new locators

func Lookup

func Lookup(kind state.Kind) NewLocator

type Object

type Object struct {
	ParameterLookup

	InputParameters  state.NamedParameters
	OutputParameters state.NamedParameters
}

func (*Object) Names

func (p *Object) Names() []string

func (*Object) Value

func (p *Object) Value(ctx context.Context, names string) (interface{}, bool, error)

type Option

type Option func(o *Options)

Option represents locator option

func WithBodyType

func WithBodyType(rType reflect.Type) Option

WithBodyType create Body Type option

func WithConstants added in v0.9.1

func WithConstants(constants map[string]interface{}) Option

WithConstants return Constants option

func WithCustom added in v0.9.1

func WithCustom(options ...interface{}) Option

WithCustom creates custom options

func WithDispatcher

func WithDispatcher(dispatcher contract.Dispatcher) Option

WithDispatcher returns options to set dispatcher

func WithForm

func WithForm(form *hstate.Form) Option

WithForm return form option

func WithHeader added in v0.9.12

func WithHeader(name, value string) Option

WithHeader return header option

func WithHeaders added in v0.9.12

func WithHeaders(header http.Header) Option

WithHeaders return headers option

func WithIOConfig

func WithIOConfig(config *config.IOConfig) Option

func WithInputParameters

func WithInputParameters(parameters state.NamedParameters) Option

WithInputParameters creates with parameter options

func WithMetrics

func WithMetrics(metrics response.Metrics) Option

WithMetrics return metrics option

func WithOutputParameters

func WithOutputParameters(parameters state.Parameters) Option

func WithParameterLookup

func WithParameterLookup(lookupFn ParameterLookup) Option

WithParameterLookup creates with parameter options

func WithParent

func WithParent(locators *KindLocator) Option

WithParent creates with parent options

func WithPathParameters added in v0.9.7

func WithPathParameters(parameters map[string]string) Option

WithPathParameters create with path parameters options

func WithQuery added in v0.9.12

func WithQuery(parameters url.Values) Option

WithQuery return query parameters option

func WithQueryParameter added in v0.9.12

func WithQueryParameter(name, value string) Option

WithQueryParameter return query parameter option

func WithReadInto

func WithReadInto(fn ReadInto) Option

func WithRequest

func WithRequest(request *http.Request) Option

WithRequest create http requestState option

func WithResource

func WithResource(resource *view.Resource) Option

WithResource return resource option

func WithState

func WithState(state *structology.State) Option

WithState returns with satte options

func WithTypes

func WithTypes(types ...*state.Type) Option

WithTypes return types option

func WithURIPattern

func WithURIPattern(URI string) Option

WithURIPattern create Path pattern requestState

func WithUnmarshal

func WithUnmarshal(fn func([]byte, interface{}) error) Option

WithUnmarshal creates with unmarshal options

func WithView

func WithView(aView *view.View) Option

WithView returns options to set view

func WithViews

func WithViews(views view.NamedViews) Option

WithViews returns with views options

type Options

type Options struct {
	Form   *hstate.Form
	Path   map[string]string
	Query  url.Values
	Header http.Header
	Body   []byte

	Parent           *KindLocator
	URIPattern       string
	BodyType         reflect.Type
	Unmarshal        Unmarshal
	IOConfig         *config.IOConfig
	Custom           []interface{}
	ParameterLookup  ParameterLookup
	ReadInto         ReadInto
	InputParameters  state.NamedParameters
	OutputParameters state.NamedParameters
	Views            view.NamedViews
	Metrics          response.Metrics
	State            *structology.State
	Dispatcher       contract.Dispatcher
	View             *view.View
	Resource         *view.Resource
	Types            []*state.Type
	Constants        map[string]interface{}
	// contains filtered or unexported fields
}

Options represents locator options

func NewOptions

func NewOptions(opts []Option) *Options

func (*Options) GetRequest

func (o *Options) GetRequest() (*http.Request, error)

func (Options) LookupParameters

func (o Options) LookupParameters(name string) *state.Parameter

func (*Options) UnmarshalFunc

func (o *Options) UnmarshalFunc() Unmarshal

type Parameter

type Parameter struct {
	ParameterLookup
	Parameters state.NamedParameters
}

func (*Parameter) Names

func (p *Parameter) Names() []string

func (*Parameter) Value

func (p *Parameter) Value(ctx context.Context, name string) (interface{}, bool, error)

type ParameterLookup

type ParameterLookup func(ctx context.Context, parameter *state.Parameter) (interface{}, bool, error)

Options represents locator options

type Path

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

func (*Path) Names

func (v *Path) Names() []string

func (*Path) Value

func (v *Path) Value(ctx context.Context, name string) (interface{}, bool, error)

type Query

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

func (*Query) Names

func (q *Query) Names() []string

func (*Query) Value

func (q *Query) Value(ctx context.Context, name string) (interface{}, bool, error)

type ReadInto

type ReadInto func(ctx context.Context, dest interface{}, aView *view.View) error

Options represents locator options

type Repeated

type Repeated struct {
	ParameterLookup
	InputParameters  state.NamedParameters
	OutputParameters state.NamedParameters
}

func (*Repeated) Names

func (p *Repeated) Names() []string

func (*Repeated) Value

func (p *Repeated) Value(ctx context.Context, names string) (interface{}, bool, error)

type State

type State struct {
	State *structology.State
}

func (*State) Names

func (p *State) Names() []string

func (*State) Value

func (p *State) Value(ctx context.Context, name string) (interface{}, bool, error)

type Transient

type Transient struct{}

func (*Transient) Names

func (v *Transient) Names() []string

func (*Transient) Value

func (v *Transient) Value(ctx context.Context, name string) (interface{}, bool, error)

type Unmarshal

type Unmarshal func([]byte, interface{}) error

Unmarshal converts data into dest

Jump to

Keyboard shortcuts

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