hook

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilProvide       = errors.New("nil provide")
	ErrNotMatchProvider = errors.New("not match provider")
)

Functions

This section is empty.

Types

type Hook

type Hook[T any] interface {
	Register(p T, index ...int) error

	Get(match func(p T) bool) (T, error)

	Update(match func(T) bool, p T) (T, error)
}

type IHook

type IHook[T any] struct {
	// contains filtered or unexported fields
}

func (*IHook[T]) Get

func (h *IHook[T]) Get(match func(T) bool) (m T, e error)

func (*IHook[T]) Register

func (h *IHook[T]) Register(provide T, indexes ...int) error

func (*IHook[T]) Update

func (h *IHook[T]) Update(match func(T) bool, provide T) (m T, e error)

Jump to

Keyboard shortcuts

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