func NewOrmWithContext(ctx context.Context, model interface{}) Orm { self := Orm{Model: model} val := reflect.ValueOf(model) d := self.GetModel("DbName", val) c := self.GetModel("CollectionName", val) Sess = db.MongoDB(ctx, "main") Collection = Sess.DB(d).C(c) return self }
func userStorage(ctx context.Context) *mgo.Collection { session := db.MongoDB(ctx, "main") return session.DB("petrucho").C("users") }