Documentation ¶
Index ¶
- func GetObjectIDString(id interface{}) string
- type Mongodb
- func (mongodb Mongodb) Close(ctx context.Context) error
- func (mongodb Mongodb) Count(ctx context.Context, collectionName string, filter interface{}, ...) (int64, error)
- func (mongodb Mongodb) Delete(ctx context.Context, collectionName string, filter interface{}, ...) (*result.DeleteResult, error)
- func (mongodb Mongodb) Deletes(ctx context.Context, collectionName string, filter interface{}, ...) (*result.DeleteResult, error)
- func (mongodb Mongodb) Find(ctx context.Context, collectionName string, filter interface{}, ...) (*entity.Entity, error)
- func (mongodb Mongodb) Finds(ctx context.Context, collectionName string, filter interface{}, ...) ([]*entity.Entity, error)
- func (mongodb Mongodb) Insert(ctx context.Context, collectionName string, doc interface{}, ...) (string, error)
- func (mongodb Mongodb) Inserts(ctx context.Context, collectionName string, docs []interface{}, ...) ([]string, error)
- func (mongodb Mongodb) Update(ctx context.Context, collectionName string, filter interface{}, ...) (*result.UpdateResult, error)
- func (mongodb Mongodb) Updates(ctx context.Context, collectionName string, filter interface{}, ...) (*result.UpdateResult, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetObjectIDString ¶ added in v0.2.0
func GetObjectIDString(id interface{}) string
getObjectIDString
Types ¶
type Mongodb ¶
Mongodb is mongo database's struct
func (Mongodb) Count ¶ added in v0.2.0
func (mongodb Mongodb) Count(ctx context.Context, collectionName string, filter interface{}, opts *easyOptions.CountOpts) (int64, error)
Count return int64,error
func (Mongodb) Delete ¶
func (mongodb Mongodb) Delete(ctx context.Context, collectionName string, filter interface{}, opts *easyOptions.DeleteOpts) (*result.DeleteResult, error)
Delete at most one document from the collection. return DeleteResult,error
func (Mongodb) Deletes ¶
func (mongodb Mongodb) Deletes(ctx context.Context, collectionName string, filter interface{}, opts *easyOptions.DeleteOpts) (*result.DeleteResult, error)
DeletesWithOptions return *result.DeleteResult,error
func (Mongodb) Find ¶
func (mongodb Mongodb) Find(ctx context.Context, collectionName string, filter interface{}, opts *easyOptions.FindOpts) (*entity.Entity, error)
Find return Entity,error
func (Mongodb) Finds ¶
func (mongodb Mongodb) Finds(ctx context.Context, collectionName string, filter interface{}, opts *easyOptions.FindOpts) ([]*entity.Entity, error)
Finds return []Entity,error
func (Mongodb) Insert ¶
func (mongodb Mongodb) Insert(ctx context.Context, collectionName string, doc interface{}, opts *easyOptions.InsertOneOpts) (string, error)
Insert return (insert ID) string,error if error,return will be ""
func (Mongodb) Inserts ¶
func (mongodb Mongodb) Inserts(ctx context.Context, collectionName string, docs []interface{}, opts *easyOptions.InsertOpts) ([]string, error)
Inserts return (insert IDs) []string,error
func (Mongodb) Update ¶
func (mongodb Mongodb) Update(ctx context.Context, collectionName string, filter interface{}, update interface{}, opts *easyOptions.UpdateOpts) (*result.UpdateResult, error)
Update just update at most one document in the collection and return *result.UpdateResult,error
func (Mongodb) Updates ¶
func (mongodb Mongodb) Updates(ctx context.Context, collectionName string, filter interface{}, update interface{}, opts *easyOptions.UpdateOpts) (*result.UpdateResult, error)
Updates return *result.UpdateResult,error
Click to show internal directories.
Click to hide internal directories.