mongo

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeEventHandler

type ChangeEventHandler func(ctx context.Context, subj, msgId string, data []byte) error

type Client

type Client interface {
	server.NamedMonitor
	io.Closer

	CreateCollection(ctx context.Context, opts *CreateCollectionOptions) error
	WatchCollection(ctx context.Context, opts *WatchCollectionOptions) error
}

type ClientOption

type ClientOption func(*DefaultClient)

func WithEventListeners added in v0.2.1

func WithEventListeners(listeners ...EventListener) ClientOption

func WithLogger

func WithLogger(logger *slog.Logger) ClientOption

func WithMongoUri

func WithMongoUri(uri string) ClientOption

type CreateCollectionOptions

type CreateCollectionOptions struct {
	DbName                       string
	CollName                     string
	Capped                       bool
	SizeInBytes                  int64
	ChangeStreamPreAndPostImages bool
}

type DefaultClient

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

func NewDefaultClient

func NewDefaultClient(opts ...ClientOption) (*DefaultClient, error)

func (*DefaultClient) Close

func (c *DefaultClient) Close() error

func (*DefaultClient) CreateCollection

func (c *DefaultClient) CreateCollection(ctx context.Context, opts *CreateCollectionOptions) error

func (*DefaultClient) Monitor

func (c *DefaultClient) Monitor(ctx context.Context) error

func (*DefaultClient) Name

func (c *DefaultClient) Name() string

func (*DefaultClient) WatchCollection

func (c *DefaultClient) WatchCollection(ctx context.Context, opts *WatchCollectionOptions) error

type EventListener added in v0.2.1

type EventListener func(*DefaultClient)

func OnCmdFailedEvent added in v0.2.1

func OnCmdFailedEvent(onCmdFailedEvent func(dbName, cmdName string, duration time.Duration)) EventListener

func OnCmdStartedEvent added in v0.2.1

func OnCmdStartedEvent(onCmdStartedEvent func(dbName, cmdName string)) EventListener

func OnCmdSucceededEvent added in v0.2.1

func OnCmdSucceededEvent(onCmdSucceededEvent func(dbName, cmdName string, duration time.Duration)) EventListener

type WatchCollectionOptions

type WatchCollectionOptions struct {
	WatchedDbName          string
	WatchedCollName        string
	ResumeTokensDbName     string
	ResumeTokensCollName   string
	ResumeTokensCollCapped bool
	StreamName             string
	ChangeEventHandler     ChangeEventHandler
}

Jump to

Keyboard shortcuts

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