func UserLogin(uid string) (err error) { s := mongo.GetSession() defer s.Close() c := collection(s, util.MONGO_COLLECTION_USER_EXPAND) err = c.Update(bson.M{"uid": uid}, bson.M{"$set": bson.M{"lltime": util.UnixMillSeconds()}, "$inc": bson.M{"logincnt": 1}}) return }
func InsertFollow(follow model.Follow) (ret model.Follow, err error) { s := mongo.GetSession() defer s.Close() c := collection(s, util.MONGO_COLLECTION_FOLLOW) follow.Ctime = util.UnixMillSeconds() return follow, c.Insert(follow) }
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 InsertComment(comment model.Comment) (ret model.Comment, err error) { s := mongo.GetSession() defer s.Close() c := collection(s, util.MONGO_COLLECTION_COMMENT) comment.Cid = bson.NewObjectId() comment.Ctime = util.UnixMillSeconds() return comment, c.Insert(comment) }
func InsertUser(user model.User) (ret model.User, err error) { s := mongo.GetSession() defer s.Close() c := collection(s, util.MONGO_COLLECTION_USER) user.Uid = bson.NewObjectId() user.Ctime = util.UnixMillSeconds() return user, c.Insert(user) }