mongo

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClientDisconnected = errors.New("could not reach mongodb: connection closed")

Functions

This section is empty.

Types

type ChangeEvent

type ChangeEvent struct {
	OperationType string                 `json:"operationType"`
	FullDocument  changeEventDocument    `json:"fullDocument"`
	ResumeToken   changeEventResumeToken `json:"_id"`
	Ns            changeEventNs          `json:"ns"`
}

func DecodeChangeEvent

func DecodeChangeEvent(changeEvent []byte) (*ChangeEvent, error)

type ChangeStreamCallback

type ChangeStreamCallback func(event *ChangeEvent, json []byte)

type Client

type Client struct {
	Db   *mongo.Database
	Conn *mongo.Client
	Options
}

func (*Client) Close

func (c *Client) Close()

func (*Client) Monitor

func (c *Client) Monitor() error

func (*Client) StartChangeStream

func (c *Client) StartChangeStream(callback ChangeStreamCallback)

func (*Client) StopChangeStream

func (c *Client) StopChangeStream()

type Options

type Options struct {
	Context context.Context
	Logger  logger.Logger
	Config  *config.MongoConfig
}

func (Options) New

func (o Options) New() *Client

Jump to

Keyboard shortcuts

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