Documentation ¶
Index ¶
- func DeleteSession(hostName string) error
- func GetDBInstance(serverIPAddress, port, dbName string, timeOutInSeconds int) (*mongo.Database, error)
- func GetFileFromGridFS(db *mongo.Database, bucketName, fileName string) ([]byte, error)
- func GetMongoConnection(hostName string) (*mongo.Client, error)
- func InitNewSession(hostDetails MongoHost) error
- func InitUsingJSON(configs []MongoHost) error
- func SaveFileToGridFS(db *mongo.Database, bucketName, fileName string, source io.Reader) (string, string, error)
- type MetaData
- type MongoDAO
- func (mg *MongoDAO) BulkDeleteData(data []interface{}) error
- func (mg *MongoDAO) BulkSaveData(data []interface{}) error
- func (mg *MongoDAO) BulkUpdate(data []interface{}) error
- func (mg *MongoDAO) BulkUpdateData(data []interface{}) error
- func (mg *MongoDAO) BulkUpsertData(data []interface{}) error
- func (mg *MongoDAO) CustomUpdate(selector map[string]interface{}, data interface{}) error
- func (mg *MongoDAO) CustomUpdateOne(selector map[string]interface{}, data interface{}) error
- func (mg *MongoDAO) DeleteAll(selector map[string]interface{}) error
- func (mg *MongoDAO) DeleteData(selector map[string]interface{}) error
- func (mg *MongoDAO) GetAggregateData(selector interface{}) (*gjson.Result, error)
- func (mg *MongoDAO) GetData(selector map[string]interface{}) (*gjson.Result, error)
- func (mg *MongoDAO) GetProjectedData(selector map[string]interface{}, projector map[string]interface{}) (*gjson.Result, error)
- func (mg *MongoDAO) PushData(selector map[string]interface{}, data interface{}) error
- func (mg *MongoDAO) SaveBulkData(data []interface{}) (string, error)
- func (mg *MongoDAO) SaveData(data interface{}) (string, error)
- func (mg *MongoDAO) SetAggregateOptions(aggregateOpts map[string]interface{})
- func (mg *MongoDAO) SetFindOps(findOps map[string]interface{})
- func (mg *MongoDAO) SetInsertManyOptions(insertManyOptions map[string]interface{})
- func (mg *MongoDAO) SetUpdateOps(updateOps map[string]interface{})
- func (mg *MongoDAO) Update(selector map[string]interface{}, data interface{}) error
- func (mg *MongoDAO) UpdateAll(selector map[string]interface{}, data interface{}) error
- func (mg *MongoDAO) Upsert(selector map[string]interface{}, data interface{}) error
- func (mg *MongoDAO) UpsertWithID(selector map[string]interface{}, data interface{}) (string, error)
- type MongoHost
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDBInstance ¶
func GetDBInstance(serverIPAddress, port, dbName string, timeOutInSeconds int) (*mongo.Database, error)
GetDBInstance - Gets database intance
func GetFileFromGridFS ¶
GetFileFromGridFS - Gets file from gridfs
func GetMongoConnection ¶
GetMongoConnection method
func InitNewSession ¶
InitNewSession - InitNewSession
func InitUsingJSON ¶
InitUsingJSON initializes Mongo Connections for give JSON data
Types ¶
type MongoDAO ¶
type MongoDAO struct { MetaData MetaData // contains filtered or unexported fields }
MongoDAO mongo DAO struct
func GetMongoDAO ¶
GetMongoDAO return mongo DAO instance
func GetMongoDAOWithHost ¶
GetMongoDAOWithHost return mongo DAO instance
func (*MongoDAO) BulkDeleteData ¶
BulkDeleteData delete data in mongo db in bulk Deleting only first document from resultset
func (*MongoDAO) BulkSaveData ¶
BulkSaveData ata Save data in mongo db in bulk
func (*MongoDAO) BulkUpdate ¶ added in v1.2.16
BulkUpdateData update data in mongo db in bulk Updating All document from resultset
func (*MongoDAO) BulkUpdateData ¶
BulkUpdateData update data in mongo db in bulk Updating only first document from resultset
func (*MongoDAO) BulkUpsertData ¶
BulkUpsertData Upsert data in mongo db in bulk
func (*MongoDAO) CustomUpdate ¶
CustomUpdate - CustomUpdate
func (*MongoDAO) CustomUpdateOne ¶
CustomUpdateOne - CustomUpdateOne
func (*MongoDAO) DeleteData ¶
DeleteData will delete data given for selector
func (*MongoDAO) GetAggregateData ¶
GetAggregateData - return result using aggregation query
func (*MongoDAO) GetProjectedData ¶
func (mg *MongoDAO) GetProjectedData(selector map[string]interface{}, projector map[string]interface{}) (*gjson.Result, error)
GetProjectedData will return query for selector and projector
func (*MongoDAO) SaveBulkData ¶ added in v1.2.16
Insert many data in mongo db
func (*MongoDAO) SetAggregateOptions ¶ added in v1.2.16
Set Aggregate Options
func (*MongoDAO) SetFindOps ¶ added in v1.2.8
Set Find Options
func (*MongoDAO) SetInsertManyOptions ¶ added in v1.2.16
Set InsertMany Options
func (*MongoDAO) SetUpdateOps ¶ added in v1.2.8
set update option for custom update
func (*MongoDAO) UpsertWithID ¶ added in v1.2.1
UpsertWithID - will update or upsert a document in the collection
If a new document is upserted then it will return the ObjectID (string) of the upserted document.
If no document is upserted the object id returned will be empty string.
type MongoHost ¶
type MongoHost struct { HostName string `json:"hostName"` Server string `json:"server"` Port int `json:"port"` Username string `json:"username"` Password string `json:"password"` Database string `json:"database"` IsDefault bool `json:"isDefault"` MaxIdleConns int `json:"maxIdleConns" ` MaxOpenConns int `json:"maxOpenConns"` ConnMaxLifetime time.Duration `json:"connMaxLifetime" ` IsDisabled bool `json:"isDisabled" ` }
MongoHost -MongoHost