Documentation ¶
Index ¶
- Variables
- func DeleteMany(filter bson.M, tempCollection interface{}) (*mongo.DeleteResult, error)
- 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{}) error
- func PopulateObjectArray(objPtr interface{}, field string, modelArrPtr interface{}) error
- func TestConnection() error
- func UpdateByID(model interface{}) error
- func UpdateDataByID(model interface{}, update 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 DeleteMany ¶ added in v0.0.3
func DeleteMany(filter bson.M, tempCollection interface{}) (*mongo.DeleteResult, error)
DeleteMany Deletes Many Objects
func DeleteOne ¶
func DeleteOne(filter bson.M, tempCollection interface{}) (*mongo.DeleteResult, error)
DeleteOne Deletes one Object
func FindAllWithOptions ¶
func FindAllWithOptions(filter bson.M, option options.FindOptions, modelsOutArrayPtr interface{}) error
FindAllWithOptions Find all with options
func FindAllWithPagination ¶
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 ¶
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 ¶
PopulateObject an Object
func PopulateObjectArray ¶
PopulateObjectArray Populates the Object Array
func TestConnection ¶ added in v0.0.7
func TestConnection() error
func UpdateDataByID ¶ added in v0.0.2
func UpdateDataByID(model interface{}, update interface{}) error
Types ¶
type DBConnection ¶
type DBConnection struct { Host string Port int Database string User string Password string ConnectionURL string SRV bool }
DBConnection DB Connection Details
func (*DBConnection) BuildConnectionURL ¶ added in v0.0.7
func (dbConnection *DBConnection) BuildConnectionURL()
Click to show internal directories.
Click to hide internal directories.