Ejemplo n.º 1
0
Archivo: token.go Proyecto: scotch/aego
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
}
Ejemplo n.º 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
}
Ejemplo n.º 3
0
Archivo: user.go Proyecto: scotch/aego
// 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
}
Ejemplo n.º 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
}
Ejemplo n.º 5
0
Archivo: acl.go Proyecto: scotch/aego
func put(c appengine.Context, key *datastore.Key) (p *Perm, err error) {
	p = &Perm{}
	_, err = ds.Put(c, key, p)
	return
}