typed_mongo

package module
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Aggregate added in v0.0.4

func Aggregate[D any, U any](ctx context.Context, c TypedCollection[D], pipeline model.AggregatePipeline, opts ...*options.AggregateOptions) ([]*U, error)

Types

type BulkWriteOperation added in v0.0.10

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

func (*BulkWriteOperation) Execute added in v0.0.10

func (*BulkWriteOperation) UpdateOne added in v0.0.10

type TypedCollection added in v0.0.3

type TypedCollection[D any] interface {
	FindOne(ctx context.Context, filter model.Filter, opts ...*options.FindOneOptions) (*D, error)
	Find(ctx context.Context, filter model.Filter, opts ...*options.FindOptions) ([]*D, error)
	FindByDocIds(ctx context.Context, ids []primitive.ObjectID, opts ...*options.FindOptions) ([]*D, error)
	CountDocuments(ctx context.Context, filter model.Filter, opts ...*options.CountOptions) (int64, error)
	InsertOne(ctx context.Context, doc D) (primitive.ObjectID, error)
	InsertMany(ctx context.Context, docs []*D) ([]primitive.ObjectID, error)
	FindOneAndUpdate(ctx context.Context, m *model.FindOneAndUpdate, opts ...*options.FindOneAndUpdateOptions) (*D, error)
	UpdateOne(ctx context.Context, m *model.UpdateOne, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
	UpdateMany(ctx context.Context, m *model.UpdateMany, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
	UpdateById(ctx context.Context, m *model.UpdateById, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
	DeleteOne(ctx context.Context, filter model.Filter, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
	DeleteMany(ctx context.Context, filter model.Filter, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
	InitializeBulkWriteOp(opts ...*options.BulkWriteOptions) *BulkWriteOperation
	// contains filtered or unexported methods
}

func NewTypedCollection added in v0.0.3

func NewTypedCollection[D any](db *mongo.Database, name string, opts ...*options.CollectionOptions) TypedCollection[D]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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