示例#1
0
文件: dao.go 项目: xing4git/chirp
func testRemoveFeed() {
	id := bson.ObjectIdHex("5069df87918d4a4c83000001")
	log.Debugf("remove feed: %+v", id)
	err := dao.RemoveFeed(id)
	if err != nil {
		log.Fatal(err)
	}
	log.Debugf("remove feed success")
}
示例#2
0
func (fs *FeedService) Delete(fid string, ret *model.Feed) error {
	logstr := fmt.Sprintf("delete feed: %s", fid)
	log.Info(logstr)
	bid := bson.ObjectIdHex(fid)
	removed, err := dao.QueryFeed(bid)
	if err != nil {
		log.Errorf("%s, error: %s", logstr, err.Error())
		return err
	}
	err = dao.RemoveFeed(bid)
	if err != nil {
		log.Errorf("%s, error: %s", logstr, err.Error())
		return err
	}
	*ret = removed
	backend.DeleteFeed(removed)
	return nil
}