mango

package module
v0.0.0-...-57fa2f2 Latest Latest
Warning

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

Go to latest
Published: May 22, 2022 License: MIT Imports: 10 Imported by: 0

README

mango

mango

Documentation

Index

Constants

View Source
const (
	STRUCT_TAG_BSON      = "bson"
	OBJECT_ID_FIELD_NAME = "_id"
)

Variables

View Source
var ErrMustHaveIdField = errors.New("must have id field")

Functions

This section is empty.

Types

type Collection

type Collection struct {
	Driver *mongo.Collection
}

func NewCollection

func NewCollection(database *mongo.Database, name string, opts ...*options.CollectionOptions) *Collection

func (*Collection) DeleteById

func (c *Collection) DeleteById(ctx context.Context, object interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)

func (*Collection) Find

func (c *Collection) Find(ctx context.Context, object interface{}, opts ...*options.FindOptions) ([]interface{}, error)

func (*Collection) FindById

func (c *Collection) FindById(ctx context.Context, object interface{}, opts ...*options.FindOneOptions) (interface{}, error)

func (*Collection) InsertOne

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

func (*Collection) Page

func (c *Collection) Page(ctx context.Context, filter interface{}, sort interface{}, page string, limit string) (cur *mongo.Cursor, err error)

func (*Collection) ReplaceById

func (c *Collection) ReplaceById(ctx context.Context, object interface{}, opts ...*options.ReplaceOptions) (*mongo.UpdateResult, error)

func (*Collection) UpdateById

func (c *Collection) UpdateById(ctx context.Context, object interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)

Jump to

Keyboard shortcuts

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