event

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPublisherNotFound = errors.New("publisher not found")
)

Functions

func RegisterPublisher

func RegisterPublisher(name string, pub Publisher)

Types

type Event

type Event struct {
	ID         uuid.UUID              `json:"id"`
	Schema     string                 `json:"schema"`
	Table      string                 `json:"table"`
	Action     string                 `json:"action"`
	Data       map[string]interface{} `json:"data"`
	CommitTime time.Time              `json:"commit_time"`
}

Event event structure for publishing to the NATS server.

func (Event) GetSubject

func (e Event) GetSubject(prefix string) string

GetSubject creates subject name from the prefix, schema and table name.

func (Event) MarshalEasyJSON

func (v Event) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Event) MarshalJSON

func (v Event) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Event) UnmarshalEasyJSON

func (v *Event) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Event) UnmarshalJSON

func (v *Event) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Publisher

type Publisher interface {
	Publish(subject string, evt Event) error
	Close() error
}

Publisher 事件发布接口

func GetPublisher

func GetPublisher(name string) (Publisher, error)

Directories

Path Synopsis
publisher

Jump to

Keyboard shortcuts

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