visitor

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AfterFetcher

type AfterFetcher interface {

	//AfterFetch one of the lifecycle hooks, returns bool if response was closed (i.e. response.WriteHeader())
	//or just an error if it is needed to stop the routers flow.
	//view is type of *[]T or *[]*T
	AfterFetch(data interface{}, response http.ResponseWriter, request *http.Request) (responseClosed bool, err error)
}

AfterFetcher represents Lifecycle hook with is called after view was read from Database. It is important to specify View type for assertion type purposes.

type BeforeFetcher

type BeforeFetcher interface {
	//BeforeFetch one of the lifecycle hooks, returns bool if response was closed (i.e. response.WriteHeader())
	//or just an error if it is needed to stop the routers flow.
	BeforeFetch(response http.ResponseWriter, request *http.Request) (responseClosed bool, err error)
}

BeforeFetcher represents Lifecycle hook which is called before view was read from the Database.

type Codec

type Codec interface {
	Value(ctx context.Context, raw string) (interface{}, error)
}

type LifecycleVisitor

type LifecycleVisitor interface{}

LifecycleVisitor visitor can implement BeforeFetcher and/or AfterFetcher

type Visitor

type Visitor struct {
	shared.Reference
	Name string
	// contains filtered or unexported fields
}

func New

func New(name string, visitor LifecycleVisitor) *Visitor

func (*Visitor) Inherit

func (v *Visitor) Inherit(visitor *Visitor)

func (*Visitor) Visitor

func (v *Visitor) Visitor() LifecycleVisitor

type Visitors

type Visitors map[string]*Visitor

func NewVisitors

func NewVisitors(visitors ...*Visitor) Visitors

func (Visitors) Lookup

func (v Visitors) Lookup(name string) (*Visitor, error)

func (Visitors) Register

func (v Visitors) Register(visitor *Visitor)

Jump to

Keyboard shortcuts

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