source

package
v0.0.0-...-efbd42f Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	ID   string `bson:"_id"`
	Vaas []byte
}

Event represents a database change.

type MongoWatcher

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

Watcher represents a listener of database changes.

func NewMongoWatcher

func NewMongoWatcher(db *mongo.Database, dbName string, handler WatcherFunc, logger *zap.Logger) *MongoWatcher

NewWatcher creates a new database event watcher.

func (*MongoWatcher) Start

func (w *MongoWatcher) Start(ctx context.Context) error

Start executes database event consumption.

type RedisSubscriber

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

RedisSubscriber is a redis subscriber.

func NewRedisSubscriber

func NewRedisSubscriber(ctx context.Context, redisClient *redis.Client, prefix, channel string, handler WatcherFunc, log *zap.Logger) (*RedisSubscriber, error)

NewRedisSubscriber create a new redis subscriber.

func (*RedisSubscriber) Close

func (w *RedisSubscriber) Close(ctx context.Context) error

Close closes the redis event consumption.

func (*RedisSubscriber) Start

func (w *RedisSubscriber) Start(ctx context.Context) error

Start executes database event consumption.

type WatcherFunc

type WatcherFunc func(*Event)

WatcherFunc is a function to send database changes.

Jump to

Keyboard shortcuts

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