codec

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2022 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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, options ...interface{}) (interface{}, error)
}

type LifecycleVisitor

type LifecycleVisitor interface {
	Codec
}

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