Beispiel #1
0
func (e *Token) Put(c appengine.Context) (err error) {
	if e.Key == nil {
		panic("token: Key not set.")
	}
	key, err := ds.Put(c, e.Key, e)
	e.Key = key
	return
}
Beispiel #2
0
// Put is a convience method to save the Profile to the datastore and
// updated the Updated property to time.Now().
func (u *Profile) Put(c appengine.Context) error {
	// TODO add error handeling for empty Provider and ID
	u.SetKey(c)
	u.Updated = time.Now()
	u.Encode()
	key, err := ds.Put(c, u.Key, u)
	u.Key = key
	return err
}
Beispiel #3
0
// Put is a convience method to save the User to the datastore and
// updated the Updated property to time.Now(). This method should
// always be usdd when saving a user, fore it does some necessary
// preprocessing.
func (u *User) Put(c appengine.Context) (err error) {
	if err = u.SetKey(c); err != nil {
		return
	}
	u.Updated = time.Now()
	u.Encode()
	key, err := ds.Put(c, u.Key, u)
	u.Key = key
	return err
}
Beispiel #4
0
// Put encodes the Values and saves the Config to the store.
func (cnfg *Config) Put(c appengine.Context) (err error) {

	val, err := json.Marshal(cnfg.Values)
	if err != nil {
		return
	}
	cnfg.ValuesJSON = val

	key, err := ds.Put(c, cnfg.Key, cnfg)
	cnfg.Key = key
	return
}
Beispiel #5
0
func put(c appengine.Context, key *datastore.Key) (p *Perm, err error) {
	p = &Perm{}
	_, err = ds.Put(c, key, p)
	return
}