handler

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AfterCreate

type AfterCreate func(ctx context.Context, resource *model.Resource, params abs.RecordCreateParams, records []*model.Record) errors.ServiceError

type AfterDelete

type AfterDelete func(ctx context.Context, resource *model.Resource, params abs.RecordDeleteParams) errors.ServiceError

type AfterGet

type AfterGet func(ctx context.Context, resource *model.Resource, id string, res *model.Record) errors.ServiceError

type AfterList

type AfterList func(ctx context.Context, resource *model.Resource, params abs.RecordListParams, records []*model.Record, total uint32) errors.ServiceError

type AfterUpdate

type AfterUpdate func(ctx context.Context, resource *model.Resource, params abs.RecordUpdateParams, records []*model.Record) errors.ServiceError

type BaseHandler

type BaseHandler struct {
	Id string
	// list
	BeforeList BeforeList
	List       List
	AfterList  AfterList

	// create
	BeforeCreate BeforeCreate
	Create       Create
	AfterCreate  AfterCreate

	// update
	BeforeUpdate BeforeUpdate
	Update       Update
	AfterUpdate  AfterUpdate

	// get
	BeforeGet BeforeGet
	Get       Get
	AfterGet  AfterGet

	// delete
	BeforeDelete BeforeDelete
	Delete       Delete
	AfterDelete  AfterDelete
}

type BeforeCreate

type BeforeCreate func(ctx context.Context, resource *model.Resource, params abs.RecordCreateParams) errors.ServiceError

type BeforeDelete

type BeforeDelete func(ctx context.Context, resource *model.Resource, params abs.RecordDeleteParams) errors.ServiceError

type BeforeGet

type BeforeGet func(ctx context.Context, resource *model.Resource, id string) errors.ServiceError

type BeforeList

type BeforeList func(ctx context.Context, resource *model.Resource, params abs.RecordListParams) errors.ServiceError

type BeforeUpdate

type BeforeUpdate func(ctx context.Context, resource *model.Resource, params abs.RecordUpdateParams) errors.ServiceError

type Create

type Create func(ctx context.Context, resource *model.Resource, params abs.RecordCreateParams) (handled bool, records []*model.Record, inserted []bool, err errors.ServiceError)

type Delete

type Delete func(ctx context.Context, resource *model.Resource, params abs.RecordDeleteParams) (handled bool, err errors.ServiceError)

type Event

type Event struct {
}

type EventSelector

type EventSelector func(ctx context.Context, resource *model.Resource) bool

func ResourceSelector

func ResourceSelector(expectedResource *model.Resource) EventSelector

type GenericHandler

type GenericHandler struct {
	BaseHandler
	// contains filtered or unexported fields
}

func NewGenericHandler

func NewGenericHandler() *GenericHandler

func (*GenericHandler) AfterCreate

func (g *GenericHandler) AfterCreate(ctx context.Context, resource *model.Resource, params abs.RecordCreateParams, records []*model.Record) errors.ServiceError

func (*GenericHandler) AfterDelete

func (g *GenericHandler) AfterDelete(ctx context.Context, resource *model.Resource, params abs.RecordDeleteParams) errors.ServiceError

func (*GenericHandler) AfterGet

func (g *GenericHandler) AfterGet(ctx context.Context, resource *model.Resource, id string, res *model.Record) errors.ServiceError

func (*GenericHandler) AfterList

func (g *GenericHandler) AfterList(ctx context.Context, resource *model.Resource, params abs.RecordListParams, records []*model.Record, total uint32) errors.ServiceError

func (*GenericHandler) AfterUpdate

func (g *GenericHandler) AfterUpdate(ctx context.Context, resource *model.Resource, params abs.RecordUpdateParams, records []*model.Record) errors.ServiceError

func (*GenericHandler) BeforeCreate

func (g *GenericHandler) BeforeCreate(ctx context.Context, resource *model.Resource, params abs.RecordCreateParams) errors.ServiceError

func (*GenericHandler) BeforeDelete

func (g *GenericHandler) BeforeDelete(ctx context.Context, resource *model.Resource, params abs.RecordDeleteParams) errors.ServiceError

func (*GenericHandler) BeforeGet

func (g *GenericHandler) BeforeGet(ctx context.Context, resource *model.Resource, id string) errors.ServiceError

func (*GenericHandler) BeforeList

func (g *GenericHandler) BeforeList(ctx context.Context, resource *model.Resource, params abs.RecordListParams) errors.ServiceError

func (*GenericHandler) BeforeUpdate

func (g *GenericHandler) BeforeUpdate(ctx context.Context, resource *model.Resource, params abs.RecordUpdateParams) errors.ServiceError

func (*GenericHandler) Create

func (g *GenericHandler) Create(ctx context.Context, resource *model.Resource, params abs.RecordCreateParams) (handled bool, records []*model.Record, inserted []bool, err errors.ServiceError)

func (*GenericHandler) Delete

func (g *GenericHandler) Delete(ctx context.Context, resource *model.Resource, params abs.RecordDeleteParams) (handled bool, err errors.ServiceError)

func (*GenericHandler) Get

func (g *GenericHandler) Get(ctx context.Context, resource *model.Resource, id string) (handled bool, record *model.Record, err errors.ServiceError)

func (*GenericHandler) List

func (g *GenericHandler) List(ctx context.Context, resource *model.Resource, params abs.RecordListParams) (handled bool, records []*model.Record, total uint32, err errors.ServiceError)

func (*GenericHandler) Register

func (g *GenericHandler) Register(handler *BaseHandler)

func (*GenericHandler) RegisterWithSelector

func (g *GenericHandler) RegisterWithSelector(handler *BaseHandler, selector EventSelector)

func (*GenericHandler) Unregister

func (g *GenericHandler) Unregister(handler *BaseHandler)

func (*GenericHandler) Update

func (g *GenericHandler) Update(ctx context.Context, resource *model.Resource, params abs.RecordUpdateParams) (handled bool, records []*model.Record, err errors.ServiceError)

type Get

type Get func(ctx context.Context, resource *model.Resource, id string) (handled bool, record *model.Record, error errors.ServiceError)

type List

type List func(ctx context.Context, resource *model.Resource, params abs.RecordListParams) (handled bool, records []*model.Record, total uint32, err errors.ServiceError)

type Update

type Update func(ctx context.Context, resource *model.Resource, params abs.RecordUpdateParams) (handled bool, records []*model.Record, err errors.ServiceError)

Jump to

Keyboard shortcuts

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