router

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DestroyItem

func DestroyItem(item *Item)

func DestroyRouter

func DestroyRouter(router *Router)

Types

type Handler

type Handler func(item *Item, data []byte)

type Item

type Item struct {
	Topic string
	// contains filtered or unexported fields
}

func NewItem

func NewItem(topic string, handlers []Handler) (*Item, error)

func (*Item) CallHandlers

func (item *Item) CallHandlers(data []byte)

func (*Item) DoIfUnSubscribe

func (item *Item) DoIfUnSubscribe(doFunc func() error) error

func (*Item) GetData

func (item *Item) GetData() []byte

func (*Item) Next

func (item *Item) Next()

func (*Item) SetUnSubscribe

func (item *Item) SetUnSubscribe()

type OnAddItemFunc

type OnAddItemFunc func(item *Item) error

type Router

type Router struct {
	Group string
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter(group string, handlers []Handler, onAddItemFunc OnAddItemFunc) *Router

func (*Router) AddItem

func (router *Router) AddItem(item *Item) error

func (*Router) AddTopic

func (router *Router) AddTopic(topic string, handlers ...Handler) error

func (*Router) RangeItem

func (router *Router) RangeItem(rangeFunc func(item *Item) error) error

Jump to

Keyboard shortcuts

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