notify

package
Version: v0.0.0-...-5ee0f5c Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Notify system

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clean

func Clean()

func NewEventID

func NewEventID() uint32

func Publish

func Publish(ctx context.Context, event uint32, payload interface{}, cb *Callback)

Publish - add new event

func Subscribe

func Subscribe(event uint32, subscriber Subscriber)

func UnSubscribe

func UnSubscribe(event uint32, subscriber Subscriber)

Types

type Callback

type Callback struct {
	CB             chan<- interface{}
	ResponseFilter string
}

type Notify

type Notify struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

type Publisher

type Publisher interface {
	Subscribe(event *int, subscriber Subscriber)
	UnSubscribe(subscriber Subscriber)
}

type Response

type Response struct {
	Name    string
	Payload interface{}
	Error   error
}

type Subscriber

type Subscriber interface {
	Notify(ctx context.Context, event uint32, payload interface{}) Response
}

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to