Пример #1
0
func testInsertFeed() {
	feed := model.Feed{Uid: "abcdef987654321", Content: model.FeedContent{Text: "second feed"}}
	log.Debugf("insert feed: %+v", feed)
	feed, err := dao.InsertFeed(feed)
	if err != nil {
		log.Fatal(err)
	}
	log.Debugf("insert ret: %+v", feed)
}
Пример #2
0
func (fs *FeedService) Create(feed model.Feed, ret *model.Feed) error {
	logstr := fmt.Sprintf("create feed: %+v", feed)
	log.Info(logstr)
	tmp, err := dao.InsertFeed(feed)
	if err != nil {
		log.Errorf("%s, error: ", logstr, err.Error())
		return err
	}
	*ret = tmp
	log.Infof("create feed result: %+v", tmp)
	backend.CreateFeed(tmp)
	return nil
}
Пример #3
0
func testInsertFeedLoc() {
	feed := model.Feed{Uid: "abcdef987654321", Content: model.FeedContent{Text: "first feed"}}
	feed, err := dao.InsertFeed(feed)
	if err != nil {
		log.Fatal(err)
	}
	loc := model.FeedLoc{}
	loc.Fid = feed.Fid.Hex()
	loc.Loc = model.Location{Ctime: feed.Ctime, Loc: [2]float64{3.4, 1.2}}
	loc, err = dao.InsertFeedLoc(loc)
	if err != nil {
		log.Fatal(err)
	}
	log.Debugf("insert feed loc: %+v", loc)
}