flow

package module
v0.49.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 5 Imported by: 0

README

Event Flow

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient() *Client

func (*Client) Configure added in v0.22.0

func (c *Client) Configure(config ClientConfig) *Client

func (*Client) Connect

func (client *Client) Connect() error

func (*Client) Disconnect

func (client *Client) Disconnect()

type ClientConfig

type ClientConfig struct {
	URL              string
	Username         string
	Password         string
	OnConnectHandler func()
}

type Event

type Event[T any] struct {
	Id        string    `json:"id"`
	Timestamp int64     `json:"timestamp"`
	EventType EventType `json:"event_type"`
	Triggerer string    `json:"triggerer"`
	Payload   T         `json:"payload"`
}

func NewEvent

func NewEvent[T any](triggerer string, eventType EventType, payload T) *Event[T]

type EventFlow added in v0.2.0

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

func NewEventFlow added in v0.2.0

func NewEventFlow[T any](client *Client, eventType EventType) *EventFlow[T]

func (*EventFlow[T]) Publish added in v0.2.0

func (flow *EventFlow[T]) Publish(triggerer string, payload T) (*Event[T], error)

func (*EventFlow[T]) SetCallback added in v0.19.0

func (flow *EventFlow[T]) SetCallback(callback func(event Event[T]))

func (*EventFlow[T]) Subscribe added in v0.2.0

func (flow *EventFlow[T]) Subscribe() error

func (*EventFlow[T]) Unsubscribe added in v0.2.0

func (flow *EventFlow[T]) Unsubscribe() error

type EventType

type EventType string

Jump to

Keyboard shortcuts

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