pqm

package
v0.0.0-...-d84d9e5 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2025 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 Action

type Action string
const (
	Update Action = "UPDATE"
	Delete Action = "DELETE"
	Insert Action = "INSERT"
)

func (Action) String

func (a Action) String() string

type Callback

type Callback[T Channelizer] func(*Message[T])

type Channelizer

type Channelizer interface {
	GetTableName() string
	GetListenerKey() string
}

type Message

type Message[T any] struct {
	Table  string `json:"table"`
	Action Action `json:"action"`
	Data   T      `json:"data"`
	Old    T      `json:"old"`
}

func ParseMessage

func ParseMessage[T any](b []byte) (message *Message[T], err error)

type Monitor

type Monitor[T Channelizer] struct {
	// contains filtered or unexported fields
}

func NewMonitor

func NewMonitor[T Channelizer](dsn string, t T, receiver Callback[T]) *Monitor[T]

func (*Monitor[T]) GetListenerCount

func (m *Monitor[T]) GetListenerCount() (n int)

func (*Monitor[T]) GetListeners

func (m *Monitor[T]) GetListeners(data T) (chs []chan T)

func (*Monitor[T]) Listen

func (m *Monitor[T]) Listen()

func (*Monitor[T]) RemoveListener

func (m *Monitor[T]) RemoveListener(ch chan T)

func (*Monitor[T]) SetListener

func (m *Monitor[T]) SetListener(data T, ch chan T)

Jump to

Keyboard shortcuts

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