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 MongoDAO
- func (mg *MongoDAO) BulkDeleteData(data []interface{}) error
- func (mg *MongoDAO) BulkSaveData(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) SaveData(data interface{}) (string, error)
- 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 {
// 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
func (*MongoDAO) BulkSaveData ¶
BulkSaveData ata Save data in mongo db in bulk
func (*MongoDAO) BulkUpdateData ¶
BulkUpdateData update data in mongo db in bulk
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) UpsertWithID ¶
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