Пример #1
0
//Delete deletes a TimeConfig from Datastore, emptying its Key field.
func (tc *TimeConfig) Delete(c appengine.Context) (err error) {
	err = gaemodel.Delete(c, tc)
	if err != nil {
		return
	}

	err = config.UpdateTimestamp(c)
	return
}
Пример #2
0
//Save saves a TimeConfig to Datastore.
//If its Key field is set, it will replace an existing record
//that has that key. If not, it will use datastore.NewIncompleteKey()
//to create a new key and set the field.
func (tc *TimeConfig) Save(c appengine.Context) (err error) {
	tc.Date = util.NormalizeDate(tc.Date)
	tc.Off = util.NormalizeTime(tc.Off)
	tc.On = util.NormalizeTime(tc.On)
	err = gaemodel.Save(c, tc)
	if err != nil {
		return
	}

	err = config.UpdateTimestamp(c)
	return
}