Documentation
¶
Index ¶
- Constants
- Variables
- type Collection
- func (c *Collection) DeleteById(ctx context.Context, object interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
- func (c *Collection) Find(ctx context.Context, object interface{}, opts ...*options.FindOptions) ([]interface{}, error)
- func (c *Collection) FindById(ctx context.Context, object interface{}, opts ...*options.FindOneOptions) (interface{}, error)
- func (c *Collection) InsertOne(ctx context.Context, object interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)
- func (c *Collection) Page(ctx context.Context, filter interface{}, sort interface{}, page string, ...) (cur *mongo.Cursor, err error)
- func (c *Collection) ReplaceById(ctx context.Context, object interface{}, opts ...*options.ReplaceOptions) (*mongo.UpdateResult, error)
- func (c *Collection) UpdateById(ctx context.Context, object interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
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) 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)
Click to show internal directories.
Click to hide internal directories.