mogo

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(ctx context.Context, clientOptions *options.ClientOptions) (*Client, error)

func (*Client) NewDB

func (c *Client) NewDB(name string) *DB

func (*Client) Transaction

func (c *Client) Transaction(fn func(sessionContext mongo.SessionContext) error) error

type Collection

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

func (*Collection) Aggregate

func (c *Collection) Aggregate(ctx context.Context, pipes []bson.D, data any) error

func (*Collection) DeleteMany

func (c *Collection) DeleteMany(ctx context.Context, filter bson.M) error

func (*Collection) DeleteOne

func (c *Collection) DeleteOne(ctx context.Context, filter bson.M) error

func (*Collection) Find

func (c *Collection) Find(ctx context.Context, filter bson.M, data any) error

func (*Collection) FindByID

func (c *Collection) FindByID(ctx context.Context, id string, data any) error

func (*Collection) InsertMany

func (c *Collection) InsertMany(ctx context.Context, docs []any) error

func (*Collection) InsertOne

func (c *Collection) InsertOne(ctx context.Context, doc any) error

func (*Collection) ReplaceOne

func (c *Collection) ReplaceOne(ctx context.Context, filter bson.M, data any) error

func (*Collection) UpdateMany

func (c *Collection) UpdateMany(ctx context.Context, filter bson.M, data any) error

func (*Collection) UpdateOne

func (c *Collection) UpdateOne(ctx context.Context, filter bson.M, data any) error

type DB

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

func (*DB) Coll

func (d *DB) Coll(name string) *Collection

func (*DB) Model added in v1.1.0

func (d *DB) Model(document Document) *Collection

type Document

type Document interface {
	DocName() string
}

Jump to

Keyboard shortcuts

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