Documentation ¶
Index ¶
- Variables
- func DeleteOne(filter bson.M, tempCollection interface{}) (*mongo.DeleteResult, error)
- func FindAll(filter bson.M, modelsOutArrayPtr interface{}) error
- func FindAllWithOptions(filter bson.M, option options.FindOptions, modelsOutArrayPtr interface{}) error
- func FindAllWithPagination(filter bson.M, start int64, count int64, modelsOutArrayPtr interface{}) error
- func FindByID(id string, b interface{}) (err error)
- func FindByObjectID(objectID primitive.ObjectID, bPtr interface{}) (err error)
- func FindOne(filter bson.M, b interface{}) (err error)
- func InitiateDB(dbConnection DBConnection)
- func InsertMany(models []interface{}) (res *mongo.InsertManyResult, err error)
- func InsertOne(modelPtr interface{}) (res *mongo.InsertOneResult, err error)
- func PopulateObject(objPtr interface{}, fieldName string, modelPtr interface{})
- func PopulateObjectArray(obj interface{}, field string, modelArrPtr interface{}) error
- func UpdateByID(model interface{}) error
- type DBConnection
- type Mongo
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ShortWaitTime time.Duration = 2 MediumWaitTime time.Duration = 5 LongWaitTime time.Duration = 10 )
ShortWaitTime Small Wait time MediumWaitTime Medium Wait Time LongWaitTime Long wait time
Functions ¶
func DeleteOne ¶
func DeleteOne(filter bson.M, tempCollection interface{}) (*mongo.DeleteResult, error)
DeleteOne Deletes one Object
func FindAllWithOptions ¶ added in v1.0.7
func FindAllWithOptions(filter bson.M, option options.FindOptions, modelsOutArrayPtr interface{}) error
FindAllWithOptions Find all with options
func FindAllWithPagination ¶ added in v1.0.6
func FindAllWithPagination(filter bson.M, start int64, count int64, modelsOutArrayPtr interface{}) error
FindAllWithPagination Get All Docs with Pagination
func FindByObjectID ¶
FindByObjectID Searches by Object ID
func InitiateDB ¶ added in v1.0.4
func InitiateDB(dbConnection DBConnection)
InitiateDB This needs to be called if you are using some other than default DB
func InsertMany ¶
func InsertMany(models []interface{}) (res *mongo.InsertManyResult, err error)
InsertMany This will insert multiple Data TODO Find a way to pass pointer and attach its ID to the respective array elements
func InsertOne ¶
func InsertOne(modelPtr interface{}) (res *mongo.InsertOneResult, err error)
InsertOne This will insert just one Data
func PopulateObject ¶ added in v1.0.4
func PopulateObject(objPtr interface{}, fieldName string, modelPtr interface{})
PopulateObject an Object
func PopulateObjectArray ¶ added in v1.0.4
PopulateObjectArray Populates the Object Array
Types ¶
type DBConnection ¶ added in v1.0.4
DBConnection DB Connection Details
Click to show internal directories.
Click to hide internal directories.