watchers

package
v0.0.0-...-0b358fe Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CollectionStruct

type CollectionStruct struct {
	SomePrimaryKey string `json:"some_primary_key,omitempty"`
}

CollectionStruct refers to structure stored in target collection

type CollectionStructWrapper

type CollectionStructWrapper struct {
	CollectionStruct `json:",inline"`
	SomePrimaryKey   string `json:"_id"` // override SomePrimaryKey with _id json identifier to unmarshall mongo data properly
}

CollectionStructWrapper is a wrapper for SomeCollectionWatcher on watcher side since mongo primary key is in "_id" column

type Mock

type Mock struct {
	Wg    *sync.WaitGroup
	Limit int

	Inserted  int
	InsertErr error
	Updated   int
	UpdateErr error
	Deleted   int
	DeleteErr error
}

Mock is a mock implementation of SomeCollectionWatcher

func (*Mock) Delete

func (m *Mock) Delete(ctx context.Context, doc []byte) error

Delete mock

func (*Mock) Insert

func (m *Mock) Insert(ctx context.Context, doc []byte) error

Insert mock

func (*Mock) Update

func (m *Mock) Update(ctx context.Context, doc []byte) error

Update mock

type SomeCollectionWatcher

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

SomeCollectionWatcher is a watcher for SomeCollectionWatcher changes

func NewSomeCollectionWatcher

func NewSomeCollectionWatcher(executor tx.Executor) *SomeCollectionWatcher

NewSomeCollectionWatcher creates a new any Collection watcher

func (SomeCollectionWatcher) Delete

func (s SomeCollectionWatcher) Delete(ctx context.Context, doc []byte) error

Delete is called when a document is deleted

func (SomeCollectionWatcher) Insert

func (s SomeCollectionWatcher) Insert(ctx context.Context, doc []byte) error

Insert is called when a new document is inserted

func (SomeCollectionWatcher) Update

func (s SomeCollectionWatcher) Update(ctx context.Context, doc []byte) error

Update is called when a document is updated

Jump to

Keyboard shortcuts

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