Documentation ¶
Index ¶
- func InitMongoDBConnection(host string, port int, connectionMode string, refreshMode bool) *mgo.Session
- func InsertData(User interface{}, session *mgo.Session, database, collection, username string) string
- func PopulateCollectionList(session *mgo.Session, dataServer *ServerData) error
- func RemoveCollectionFromDB(session *mgo.Session, database string, collection string) error
- func RemoveUser(session *mgo.Session, database, collection, username string) error
- type Collection
- type Database
- type ServerData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitMongoDBConnection ¶
func InitMongoDBConnection(host string, port int, connectionMode string, refreshMode bool) *mgo.Session
InitMongoDBConnection return a session to the Mongo instances configured in input. If input is null connect to the default instances
func InsertData ¶
func InsertData(User interface{}, session *mgo.Session, database, collection, username string) string
InsertData is used for insert a generic data into a collection It take in input the session, database and collection where insert the change
func PopulateCollectionList ¶
func PopulateCollectionList(session *mgo.Session, dataServer *ServerData) error
PopulateCollectionList populate the list of Collections from the database list name in input. Populate the structure in input, just for test purpouse
func RemoveCollectionFromDB ¶
RemoveCollectionFromDB is used for remove the collection in input from the db
Types ¶
type Collection ¶
type Collection struct { Name string Document []interface{} }
Collection struct for DB
func GetCollectionsData ¶
func GetCollectionsData(session *mgo.Session, database string) []Collection
GetCollectionsData is used for retrieve the list of Collections from the DB in input. It return a list of collection containing all the data [Used for test purpouse]
type Database ¶
type Database struct { Name string Collections []Collection }
Database struct for DB
type ServerData ¶
type ServerData struct {
DatabaseList []Database
}
ServerData struct for manage DB
func InitServerData ¶
func InitServerData(session *mgo.Session) *ServerData
InitServerData is used for retrieve the list of DBs name from the mongo instance in input. It fetch the list of DBs from the Mongo instance. Return a pointer to a structure for store and manipulate the data