mongo

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Set is a Wire provider set that provides a MongoDB client.

Functions

This section is empty.

Types

type ChangeStream

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

ChangeStream is a struct that represents a change stream.

func NewChangeStream

func NewChangeStream(ctx context.Context, params ChangeStreamParams, opts ...ChangeStreamOption) (*ChangeStream, error)

NewChangeStream creates a new change stream instance.

func (*ChangeStream) Close

func (c *ChangeStream) Close(ctx context.Context) error

Close closes the change stream cursor.

func (*ChangeStream) Run

func (c *ChangeStream) Run(ctx context.Context)

Run starts watching change stream.

type ChangeStreamHandler

type ChangeStreamHandler func(ctx context.Context, event model.ChangeEvent) error

ChangeStreamHandler is a type of handler function that handles ChangeStream.

type ChangeStreamOption

type ChangeStreamOption func(opts *ChangeStreamOptions)

ChangeStreamOption is a type of option function for change stream.

func WithBatchSize

func WithBatchSize(batchSize int32) ChangeStreamOption

WithBatchSize sets the batch size for ChangeStream.

type ChangeStreamOptions

type ChangeStreamOptions struct {
	*options.ChangeStreamOptions
}

ChangeStreamOptions is a struct that represents options for change stream.

type ChangeStreamParams added in v0.0.3

type ChangeStreamParams struct {
	Client     *Client
	Handler    ChangeStreamHandler
	Storage    persistent.StorageBuffer
	Database   string
	Collection string
}

ChangeStreamParams is a struct that represents parameters for creating a ChangeStream.

type Client

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

Client is a MongoDB client.

func NewClient

func NewClient(ctx context.Context, cfg *config.MongoDB) (*Client, error)

NewClient creates a new MongoDB client.

func (*Client) Disconnect

func (c *Client) Disconnect(ctx context.Context) error

Disconnect disconnects the client from the MongoDB instance.

Jump to

Keyboard shortcuts

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