Documentation ¶
Index ¶
- Constants
- func AllEntities(tableName string, list interface{}) error
- func AllEntitiesWithCriteria(tableName string, criterion bson.M, list interface{}) error
- func AllEntitiesWithCriteriaAndSortDescriptions(tableName string, criterion bson.M, sortDescriptions []string, ...) error
- func AllEntitiesWithSortDescriptions(tableName string, sortDescriptions []string, list interface{}) error
- func ConnectMongo()
- func Count(tableName string) (int, error)
- func CreateConfigs()
- func DeleteEntity(tableName string, entityID bson.ObjectId) error
- func DeleteEntityWithCriteria(tableName string, criterion bson.M) error
- func EntityWithCriteria(tableName string, criterion bson.M, entity interface{}) error
- func EntityWithID(tableName string, entityID bson.ObjectId, entity interface{}) error
- func GetEventualSession() (*mgo.Session, *mgo.Database)
- func GetMonotonicSession() (*mgo.Session, *mgo.Database)
- func GetStrongSession() (*mgo.Session, *mgo.Database)
- func SaveEntity(tableName string, entityID bson.ObjectId, entity interface{}) error
- type Config
Constants ¶
const ConfigFile = "mongodb.cfg"
ConfigFile defines configuration file's name.
Variables ¶
This section is empty.
Functions ¶
func AllEntities ¶
AllEntities returns an entity collection sort by id.
func AllEntitiesWithCriteria ¶
AllEntitiesWithCriteria returns an entity collection base on criterion sort by id.
func AllEntitiesWithCriteriaAndSortDescriptions ¶
func AllEntitiesWithCriteriaAndSortDescriptions(tableName string, criterion bson.M, sortDescriptions []string, list interface{}) error
AllEntitiesWithCriteriaAndSortDescriptions returns an entity collection base on criterion sort by id.
func AllEntitiesWithSortDescriptions ¶
func AllEntitiesWithSortDescriptions(tableName string, sortDescriptions []string, list interface{}) error
AllEntitiesWithSortDescriptions returns an entity collection sort by defined.
func DeleteEntity ¶
DeleteEntity deletes a record from collection.
func DeleteEntityWithCriteria ¶
DeleteEntityWithCriteria deletes a record from collection with creteria.
func EntityWithCriteria ¶
EntityWithCriteria finds entity with creteria.
func EntityWithID ¶
EntityWithID finds entity with ID.
func GetEventualSession ¶
func GetEventualSession() (*mgo.Session, *mgo.Database)
GetEventualSession clones session with eventual mode.
func GetMonotonicSession ¶
func GetMonotonicSession() (*mgo.Session, *mgo.Database)
GetMonotonicSession clones session with monotonic mode.
func GetStrongSession ¶
func GetStrongSession() (*mgo.Session, *mgo.Database)
GetStrongSession clones session with strong mode.
Types ¶
type Config ¶
type Config struct { Addresses []string `json:"addresses"` Database string `json:"database"` Username string `json:"username"` Password string `json:"password"` }
Config descripts a configuration object that will be used during application life time.
func LoadConfigs ¶
func LoadConfigs() *Config
LoadConfigs retrieves previous configuration from file.