session

package
v0.39.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithOutputFields added in v0.39.0

func ContextWithOutputFields(ctx context.Context, fields ...string) context.Context

func ContextWithOutputProjection added in v0.39.0

func ContextWithOutputProjection(ctx context.Context, output interface{}) context.Context

func ContextWithViewOutputFields added in v0.39.0

func ContextWithViewOutputFields(ctx context.Context, viewName string, fields ...string) context.Context

func ContextWithViewOutputProjection added in v0.39.0

func ContextWithViewOutputProjection(ctx context.Context, viewName string, output interface{}) context.Context

func EmptyOutputFieldsError added in v0.39.0

func EmptyOutputFieldsError(viewName string) error

func OutputFieldsFromContext added in v0.39.0

func OutputFieldsFromContext(ctx context.Context, viewName string) []string

func OutputFieldsHintFromContext added in v0.39.0

func OutputFieldsHintFromContext(ctx context.Context, viewName string) bool

func OutputProjectionFromContext added in v0.39.0

func OutputProjectionFromContext(ctx context.Context, viewName string) interface{}

Types

type Copier

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

Copier copies data between struct

func NewCopier

func NewCopier(src, dest reflect.Type) *Copier

NewCopier creates a copier

func (*Copier) Copy

func (c *Copier) Copy(src interface{}, dest interface{}, opts ...CopierOption) error

Copy copes field with the same name (initial version)

type CopierOption

type CopierOption func(o *copierOptions)

Copier copies data between struct

func WithDebug

func WithDebug() CopierOption

type LoadStateOption added in v0.21.7

type LoadStateOption func(o *loadStateOptions)

func WithHasMarker added in v0.21.8

func WithHasMarker() LoadStateOption

func WithLoadStateSkipKind added in v0.21.7

func WithLoadStateSkipKind(kinds ...state.Kind) LoadStateOption

func WithValuePresenceFallback added in v0.36.0

func WithValuePresenceFallback() LoadStateOption

WithValuePresenceFallback treats non-zero values as present when no Has marker is available. This is opt-in to avoid changing behavior for existing inputs that intentionally omit markers.

type Option

type Option func(o *Options)

func AsOptions

func AsOptions(opts ...[]Option) []Option

AsOptions merges multi options

func WithAuth added in v0.11.0

func WithAuth(auth *auth.Service) Option

func WithCacheDisabled added in v0.39.0

func WithCacheDisabled(flag bool) Option

func WithCodeOptions

func WithCodeOptions(options ...codec.Option) Option

func WithComponent added in v0.9.14

func WithComponent(component *repository.Component) Option

func WithEmbeddedFS

func WithEmbeddedFS(fs *embed.FS) Option

func WithLocatorOptions

func WithLocatorOptions(options ...locator.Option) Option

func WithLocators

func WithLocators(locators *locator.KindLocator) Option

func WithLogger added in v0.20.9

func WithLogger(logger logger.Logger) Option

func WithOperate added in v0.9.14

func WithOperate(operate func(ctx context.Context, aSession *Session, aComponent *repository.Component) (interface{}, error)) Option

func WithOutputFields added in v0.39.0

func WithOutputFields(fields ...string) Option

func WithOutputProjection added in v0.39.0

func WithOutputProjection(output interface{}) Option

func WithPreseedCache added in v0.21.1

func WithPreseedCache(flag bool) Option

WithPreseedCache controls whether NewSession should pre-seed child cache from parent (default false)

func WithRegistry added in v0.9.13

func WithRegistry(registry *repository.Registry) Option

func WithReportNotAssignable

func WithReportNotAssignable(flag bool) Option

func WithSQLTx added in v0.21.3

func WithSQLTx(tx *sql.Tx) Option

WithSQLTx associates an existing SQL transaction with the session

func WithScope added in v0.9.14

func WithScope(scope string) Option

func WithStateResource

func WithStateResource(resource state.Resource) Option

func WithTypes

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

func WithViewOutputFields added in v0.39.0

func WithViewOutputFields(viewName string, fields ...string) Option

func WithViewOutputProjection added in v0.39.0

func WithViewOutputProjection(viewName string, output interface{}) Option

func WithViewProjectionColumns added in v0.39.0

func WithViewProjectionColumns(viewName string, columns []string) Option

type Options

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

func NewOptions

func NewOptions(options ...Option) *Options

func (*Options) AddCodec

func (o *Options) AddCodec(option codec.Option)

func (*Options) AddLocator

func (o *Options) AddLocator(option locator.Option)

func (*Options) AddLocators

func (o *Options) AddLocators(options ...locator.Option)

func (*Options) CacheDisabled added in v0.39.0

func (o *Options) CacheDisabled() bool

func (*Options) Clone

func (o *Options) Clone() *Options

func (*Options) HasInputParameters added in v0.9.7

func (o *Options) HasInputParameters() bool

func (*Options) Indirect

func (o *Options) Indirect(flag bool, options ...locator.Option) *Options

func (*Options) Logger added in v0.20.9

func (o *Options) Logger() logger.Logger

func (*Options) Operate added in v0.9.14

func (o *Options) Operate() func(ctx context.Context, aSession *Session, aComponent *repository.Component) (interface{}, error)

func (*Options) Registry added in v0.9.13

func (o *Options) Registry() *repository.Registry

func (*Options) SqlTx added in v0.21.3

func (o *Options) SqlTx() *sql.Tx

SqlTx returns associated SQL transaction (if any)

func (*Options) State

func (o *Options) State() *view.State

type OutputProjection added in v0.39.0

type OutputProjection struct {
	View       string
	Output     interface{}
	Fields     []string
	FieldsHint bool
}

type Redirect added in v0.9.12

type Redirect struct {
	Route   *xhttp.Route
	Request *http.Request
}

type Session

type Session struct {
	Options
	Types    state.Types
	Redirect *Redirect
	// contains filtered or unexported fields
}

func Context

func Context(ctx context.Context) *Session

Context returns session context

func New

func New(aView *view.View, opts ...Option) *Session

func (*Session) Apply

func (s *Session) Apply(opts ...Option)

Apply applies Options

func (*Session) ApplyOutputProjection added in v0.39.0

func (s *Session) ApplyOutputProjection(ctx context.Context, aView *view.View) error

func (*Session) Auth added in v0.11.0

func (s *Session) Auth() *auth.Service

func (*Session) Bind added in v0.15.0

func (s *Session) Bind(ctx context.Context, dest interface{}, opts ...hstate.Option) (err error)

func (*Session) ClearCache

func (s *Session) ClearCache(parameters state.Parameters)

func (*Session) Context

func (s *Session) Context(ctx context.Context, forceNew bool) context.Context

Context returns session context

func (*Session) HttpRequest

func (s *Session) HttpRequest(ctx context.Context, options *Options) (*http.Request, error)

func (*Session) InitKinds

func (s *Session) InitKinds(kinds ...state.Kind) error

func (*Session) Into

func (s *Session) Into(ctx context.Context, dest interface{}, opts ...hstate.Option) (err error)

Into binds state into provided destination

func (*Session) LoadState

func (s *Session) LoadState(parameters state.Parameters, aState interface{}, opts ...LoadStateOption) error

func (*Session) LookupValue

func (s *Session) LookupValue(ctx context.Context, parameter *state.Parameter, opts *Options) (value interface{}, has bool, err error)

func (*Session) MarshalJSON

func (s *Session) MarshalJSON() ([]byte, error)

func (*Session) NewSession added in v0.21.1

func (s *Session) NewSession(component *repository.Component) *Session

func (*Session) Populate

func (s *Session) Populate(ctx context.Context) error

Populate populates view state

func (*Session) ReadInto

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

func (*Session) ResetViewState

func (s *Session) ResetViewState(ctx context.Context, aView *view.View) error

ResetViewState sets view state

func (*Session) SetCacheValue

func (s *Session) SetCacheValue(ctx context.Context, parameter *state.Parameter, value interface{}) error

SetCacheValue sets cache value

func (*Session) SetState

func (s *Session) SetState(ctx context.Context, parameters state.Parameters, aState *structology.State, opts *Options) error

func (*Session) SetView added in v0.9.0

func (s *Session) SetView(view *view.View)

func (*Session) SetViewState

func (s *Session) SetViewState(ctx context.Context, aView *view.View) error

SetViewState sets view state as long state has not been populated

func (*Session) Unmarshal

func (s *Session) Unmarshal(parameters state.Parameters, data []byte) error

func (*Session) Value

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

func (*Session) ValuesOf added in v0.9.12

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

func (*Session) ViewOptions

func (s *Session) ViewOptions(aView *view.View, opts ...Option) *Options

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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