Documentation ¶
Index ¶
- Variables
- func CountDocuments(collection string, data primitive.M) (int64, error)
- func DBConnection(c *mongo.Database)
- type CreateService
- func (createservice CreateService) InsertManyDocuments(data []interface{}, collection string) (interface{}, error, bool)
- func (createservice CreateService) InsertOneDocument(data map[string]interface{}, collection string) (interface{}, error, bool)
- func (createservice CreateService) UpdateDocuments(condition interface{}, data interface{}, collection string) (interface{}, error, bool)
- type DeleteService
- func (deleteservice DeleteService) DeleteMany(filter interface{}, coll string) (interface{}, error, bool)
- func (deleteservice DeleteService) DeleteManyWithFilter(filter interface{}, data interface{}, coll string) (interface{}, error, bool)
- func (deleteservice DeleteService) FindOneAndDelete(filter interface{}, coll string) (interface{}, error, bool)
- func (deleteservice DeleteService) FindOneAndUpdate(filter interface{}, arrayFilter []interface{}, update interface{}, coll string) (interface{}, error, bool)
- type InitService
- type ReadService
- func (readservice ReadService) AggregateDocument(data []bson.M, collection string) (interface{}, error, bool)
- func (readservice ReadService) FindDocument(filter bson.M, projection bson.M, collection string, sort interface{}, ...) (interface{}, error, bool)
- func (readservice ReadService) FindDocumentCount(filter bson.M, projection bson.M, collection string, sort interface{}, ...) (interface{}, error, bool)
- func (readservice ReadService) FindOneDocument(filter bson.M, projection bson.M, collection string, sort interface{}, ...) (interface{}, error, bool)
- type UpdateService
- func (updateservice UpdateService) FindOneAndReplace(filter interface{}, update interface{}, coll string) (interface{}, error, bool)
- func (updateservice UpdateService) FindOneAndUpdate(filter interface{}, arrayFilter []interface{}, update interface{}, coll string) (interface{}, error, bool)
- func (updateservice UpdateService) UpdateManyDocuments(condition interface{}, data interface{}, coll string) (interface{}, error, bool)
Constants ¶
This section is empty.
Variables ¶
var Database *mongo.Database
Functions ¶
func CountDocuments ¶ added in v1.4.0
get len Documents checkCollectionExist is to check collection exist or not
Types ¶
type CreateService ¶
type CreateService struct{}
CreateService is to handle create function relation db query
func (CreateService) InsertManyDocuments ¶
func (createservice CreateService) InsertManyDocuments(data []interface{}, collection string) (interface{}, error, bool)
InsertManyDocuments is to insert many document
func (CreateService) InsertOneDocument ¶
func (createservice CreateService) InsertOneDocument(data map[string]interface{}, collection string) (interface{}, error, bool)
InsertOneDocument is to insert one document
func (CreateService) UpdateDocuments ¶
func (createservice CreateService) UpdateDocuments(condition interface{}, data interface{}, collection string) (interface{}, error, bool)
UpdateDocuments is to insert many document
type DeleteService ¶
type DeleteService struct{}
DeleteService is to handle Delete function
func (DeleteService) DeleteMany ¶
func (deleteservice DeleteService) DeleteMany(filter interface{}, coll string) (interface{}, error, bool)
DeleteMany is for Delete document
func (DeleteService) DeleteManyWithFilter ¶
func (deleteservice DeleteService) DeleteManyWithFilter(filter interface{}, data interface{}, coll string) (interface{}, error, bool)
UpdateDocuments is to insert many document
func (DeleteService) FindOneAndDelete ¶
func (deleteservice DeleteService) FindOneAndDelete(filter interface{}, coll string) (interface{}, error, bool)
FindOneAndDelete is for Delete document
func (DeleteService) FindOneAndUpdate ¶
func (deleteservice DeleteService) FindOneAndUpdate(filter interface{}, arrayFilter []interface{}, update interface{}, coll string) (interface{}, error, bool)
FindOneAndUpdate is for update document
type InitService ¶
type InitService struct{}
InitService is to handle create function relation db query
type ReadService ¶
type ReadService struct{}
ReadService is to handle create function relation db query
func (ReadService) AggregateDocument ¶
func (readservice ReadService) AggregateDocument(data []bson.M, collection string) (interface{}, error, bool)
AggregateDocument is to read documents
func (ReadService) FindDocument ¶
func (ReadService) FindDocumentCount ¶
type UpdateService ¶
type UpdateService struct{}
UpdateService is to handle update function
func (UpdateService) FindOneAndReplace ¶
func (updateservice UpdateService) FindOneAndReplace(filter interface{}, update interface{}, coll string) (interface{}, error, bool)
FindOneAndReplace is for replace document
func (UpdateService) FindOneAndUpdate ¶
func (updateservice UpdateService) FindOneAndUpdate(filter interface{}, arrayFilter []interface{}, update interface{}, coll string) (interface{}, error, bool)
FindOneAndUpdate is for update document
func (UpdateService) UpdateManyDocuments ¶
func (updateservice UpdateService) UpdateManyDocuments(condition interface{}, data interface{}, coll string) (interface{}, error, bool)
UpdateDocuments is to insert many document