示例#1
0
func updateShowAttributes(req *wcg.Request, s *event.Show) *event.Show {
	s.OpenAt, _ = util.ParseDateTime(req.Form("open_at"))
	s.StartAt, _ = util.ParseDateTime(req.Form("start_at"))
	s.Latitude, _ = strconv.ParseFloat(req.Form("latitude"), 64)
	s.Longitude, _ = strconv.ParseFloat(req.Form("longitude"), 64)
	s.VenueId = req.Form("venue_id")
	s.VenueName = req.Form("venue_name")
	s.PiaLink = req.Form("pia_link")
	s.YAKeyword = req.Form("ya_keyword")
	return s
}
示例#2
0
func (d *ShowDriver) Save(s *event.Show) (*event.Show, error) {
	_now := now()
	if s.Id == "" {
		uid, _ := wcg.UUID()
		s.Id = uid
		s.CreatedAt = _now
		s.UpdatedAt = _now
	} else {
		s.UpdatedAt = _now
	}
	tkey := d.eventd.NewKey(s.EventId, 0, nil)
	key := d.NewKey(s.Id, 0, tkey)
	_, err := d.Put(key, s)
	return s, err
}