pb

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EventComposer

func EventComposer(title string, data interface{}, opts ...Opt) *composer

Types

type Channel

type Channel string

type Entity

type Entity interface {
	EntityID() string
	EntityName() string
	EntityObject() string
	EntityImage() *sdkcm.Image
}

type EntityDetail

type EntityDetail struct {
	Id     string       `json:"id"`
	Name   string       `json:"name"`
	Object string       `json:"object"`
	Image  *sdkcm.Image `json:"image"`
}

func (*EntityDetail) GetId

func (e *EntityDetail) GetId() string

func (*EntityDetail) GetImage

func (e *EntityDetail) GetImage() *sdkcm.Image

func (*EntityDetail) GetName

func (e *EntityDetail) GetName() string

func (*EntityDetail) GetObject

func (e *EntityDetail) GetObject() string

type Event

type Event struct {
	Id         string        `json:"id"`
	Title      string        `json:"title"`
	Author     *EntityDetail `json:"author"`
	Receiver   *EntityDetail `json:"receiver"`
	Channel    Channel       `json:"channel"`
	Data       interface{}   `json:"data"`
	Ack        func()
	CreatedAt  time.Time `json:"created_at"`
	RemoteData []byte    `json:"remote_data"`
}

func NewEvent

func NewEvent(title string, author, receiver Entity, data interface{}) *Event

func (*Event) DoAck

func (e *Event) DoAck()

func (*Event) GetAuthor

func (e *Event) GetAuthor() *EntityDetail

func (*Event) GetChannel

func (e *Event) GetChannel() Channel

func (*Event) GetData

func (e *Event) GetData() interface{}

func (*Event) GetID

func (e *Event) GetID() string

func (*Event) GetReceiver

func (e *Event) GetReceiver() *EntityDetail

func (*Event) GetTitle

func (e *Event) GetTitle() string

func (*Event) GetWhen

func (e *Event) GetWhen() interface{}

func (*Event) SetAck

func (e *Event) SetAck(f func())

func (*Event) SetChannel

func (e *Event) SetChannel(c Channel)

func (Event) String

func (e Event) String() string

type Opt

type Opt func(*composer)

func WithReceiverIdAndObject

func WithReceiverIdAndObject(receiverId, obj string) Opt

func WithReceiverNameAndImage

func WithReceiverNameAndImage(name string, image *sdkcm.Image) Opt

func WithSenderIdAndObject

func WithSenderIdAndObject(senderId, obj string) Opt

func WithSenderNameAndImage

func WithSenderNameAndImage(name string, image *sdkcm.Image) Opt

type Provider

type Provider interface {
	Publish(ctx context.Context, channel Channel, data *Event) error
	Subscribe(ctx context.Context, channel Channel) (c <-chan *Event, close func())
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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