mgo

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(opts ...Option) error

Types

type ConnInfo

type ConnInfo struct {
	Addr string
	Name string
}

type LCollection

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

func Collection

func Collection(db string, collection string) *LCollection

func (*LCollection) Aggregate

func (c *LCollection) Aggregate(ctx context.Context, pipeline interface{}, opts ...*options.AggregateOptions) (*mongo.Cursor, error)

func (*LCollection) BulkWrite

func (c *LCollection) BulkWrite(ctx context.Context, models []mongo.WriteModel, opts ...*options.BulkWriteOptions) (*mongo.BulkWriteResult, error)

func (*LCollection) Count

func (c *LCollection) Count(ctx context.Context, filter interface{},
	opts ...*options.CountOptions) (int64, error)

func (*LCollection) CountDocuments

func (c *LCollection) CountDocuments(ctx context.Context, filter interface{},
	opts ...*options.CountOptions) (int64, error)

func (*LCollection) CreateIndexes

func (c *LCollection) CreateIndexes(ctx context.Context, indexmodels []mongo.IndexModel, opts ...*options.CreateIndexesOptions) ([]string, error)

func (*LCollection) DeleteMany

func (c *LCollection) DeleteMany(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)

func (*LCollection) DeleteOne

func (c *LCollection) DeleteOne(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)

func (*LCollection) DeleteOneIndex

func (c *LCollection) DeleteOneIndex(ctx context.Context, indexname string, opts ...*options.DropIndexesOptions) (bson.Raw, error)

func (*LCollection) Find

func (c *LCollection) Find(ctx context.Context, filter interface{}, opts ...*options.FindOptions) (*mongo.Cursor, error)

func (*LCollection) FindOne

func (c *LCollection) FindOne(ctx context.Context, filter interface{}, opts ...*options.FindOneOptions) *mongo.SingleResult

func (*LCollection) FindOneAndUpdate

func (c *LCollection) FindOneAndUpdate(ctx context.Context, filter interface{}, update interface{}, opts ...*options.FindOneAndUpdateOptions) *mongo.SingleResult

func (*LCollection) IndexList

func (c *LCollection) IndexList(ctx context.Context, opts ...*options.ListIndexesOptions) (*mongo.Cursor, error)

func (*LCollection) InsertMany

func (c *LCollection) InsertMany(ctx context.Context, document []interface{}) (*mongo.InsertManyResult, error)

func (*LCollection) InsertOne

func (c *LCollection) InsertOne(ctx context.Context, document interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)

func (*LCollection) ReplaceOne

func (c *LCollection) ReplaceOne(ctx context.Context, filter interface{}, document interface{}, opts ...*options.ReplaceOptions) (*mongo.UpdateResult, error)

func (*LCollection) SetTTL

func (c *LCollection) SetTTL(ctx context.Context, indexmodel mongo.IndexModel, opts ...*options.CreateIndexesOptions) (string, error)

func (*LCollection) UpdateOne

func (c *LCollection) UpdateOne(ctx context.Context, filter interface{}, document interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)

type Option

type Option func(*Parm)

Option config wraps

func AppendConn

func AppendConn(info ConnInfo) Option

func WithConnPoolSize

func WithConnPoolSize(size uint64) Option

func WithConnTimeout

func WithConnTimeout(timeout time.Duration) Option

func WithTracer

func WithTracer(trc tracer.ITracer) Option

type Parm

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

Jump to

Keyboard shortcuts

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