state

package
v0.0.0-...-dec35dd Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 5 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DBProviderKey dBProviderKey = "dbProvider"

Functions

This section is empty.

Types

type DBProvider

type DBProvider func(name string) (*sql.DB, error)

DBProvider represents a database provider

type Form

type Form struct {
	url.Values
	// contains filtered or unexported fields
}

func NewForm

func NewForm() *Form

func (*Form) Add

func (f *Form) Add(key, value string)

Add safely adds the value to the key.

func (*Form) Del

func (f *Form) Del(key string)

Del safely deletes the values associated with key.

func (*Form) Get

func (f *Form) Get(key string) string

Get safely gets the first value associated with the given key.

func (*Form) Lookup

func (f *Form) Lookup(key string) ([]string, bool)

Lookup safely gets the first value associated with the given key.

func (*Form) Mutex

func (f *Form) Mutex() *sync.RWMutex

func (*Form) Set

func (f *Form) Set(key string, values ...string)

Set safely sets the value for a key.

func (*Form) SetValues

func (f *Form) SetValues(values url.Values)

type Option

type Option func(o *Options)

Option represents state option

func WithBody

func WithBody(body []byte) Option

WithBody returns option with body

func WithConstants

func WithConstants(key string, value string) Option

WithConstants returns option with constants

func WithForm

func WithForm(form *Form) Option

WithForm returns option with form

func WithHeader

func WithHeader(name, value string) Option

WithHeader returns option with header

func WithHeaders

func WithHeaders(headers http.Header) Option

WithHeaders returns option with headers

func WithHttpRequest

func WithHttpRequest(httpRequest *http.Request) Option

WithHttpRequest returns option with scope

func WithPathParameter

func WithPathParameter(name, value string) Option

WithPathParameter returns option with path parameters

func WithQuery

func WithQuery(query url.Values) Option

WithQuery returns option with query

func WithQueryParameter

func WithQueryParameter(name, value string) Option

WithQueryParameter returns option with query parameters

func WithQueryParameters

func WithQueryParameters(name string, values []string) Option

WithQueryParameters returns option with query parameters

func WithScope

func WithScope(scope string) Option

WithScope returns option with scope

type Options

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

Options represents state options

func NewOptions

func NewOptions(options ...Option) *Options

NewOptions returns option with scope

func (*Options) Body

func (s *Options) Body() []byte

Body returns body

func (*Options) Constants

func (s *Options) Constants() map[string]interface{}

Constants returns constants

func (*Options) Form

func (s *Options) Form() *Form

Form returns form

func (*Options) Headers

func (s *Options) Headers() http.Header

Headers returns headers

func (*Options) HttpRequest

func (s *Options) HttpRequest() *http.Request

HttpRequest returns http request

func (*Options) PathParameters

func (s *Options) PathParameters() map[string]string

PathParameters returns path parameters

func (*Options) Query

func (s *Options) Query() url.Values

Query returns query

func (*Options) Scope

func (s *Options) Scope() string

Scope returns scope

type Service

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

func New

func New(stater Stater) *Service

func (Service) Into

func (s Service) Into(ctx context.Context, state interface{}, opt ...Option) error

func (Service) Value

func (s Service) Value(ctx context.Context, key string) (interface{}, bool, error)

type Stater

type Stater interface {
	Into(ctx context.Context, any interface{}, opt ...Option) error

	Value(ctx context.Context, key string) (interface{}, bool, error)

	ValuesOf(ctx context.Context, any interface{}) (map[string]interface{}, error)
}

Jump to

Keyboard shortcuts

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