mongo

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: MIT Imports: 11 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 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 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