mongo_util

package
v0.0.0-...-ba64992 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InsertedIDToObjectId

func InsertedIDToObjectId(insertedID interface{}) primitive.ObjectID

func WithSession

func WithSession(database *mongo.Database, ctx context.Context, fn func(sc mongo.SessionContext) error) error

func WithTransaction

func WithTransaction(database *mongo.Database, ctx context.Context, fn func(sc mongo.SessionContext) error) error

Types

type DocumentKey

type DocumentKey struct {
	Id primitive.ObjectID `bson:"_id"`
}

type MongoUpdateStatement

type MongoUpdateStatement struct {
	Set         bsoncore.Document `bson:"$set,omitempty"`
	SetOnInsert bsoncore.Document `bson:"$setOnInsert,omitempty"`
}

type WatchChangeEvent

type WatchChangeEvent[D any] struct {
	OperationType string      `bson:"operationType"`
	FullDocument  D           `bson:"fullDocument,omitempty"`
	DocumentKey   DocumentKey `bson:"documentKey"`
}

Jump to

Keyboard shortcuts

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