func InsertFeed(feed model.Feed) (ret model.Feed, err error) { s := mongo.GetSession() defer s.Close() c := collection(s, util.MONGO_COLLECTION_FEED) feed.Fid = bson.NewObjectId() feed.Ctime = util.UnixMillSeconds() return feed, c.Insert(feed) }
func redisFeeds(key string, from int64, to int64) (rets []model.Feed, err error) { var strs []string strs, err = redisStrs(key, from, to) if err != nil { return nil, err } rets = make([]model.Feed, len(strs)) for pos, str := range strs { feed := model.Feed{} feed.Fid = bson.ObjectIdHex(str) rets[pos] = feed } return }