Skip to content

ThePiachu/GAE-Go-Datastore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a library for easily handling App Engine's Datastore, Memcache and Blobstore calls. The main advantage it offers is being able to load data from or save data to Memcache and Datastore in one quick call. Example use:


import (
	"Datastore"
	"appengine"
)

type Address struct {
	Address string
	...
}

var AddressStr string = "Address"

func LoadAddress(c appengine.Context, add string) (*Address, error) {
	address:=new(Address)
	err:=Datastore.GetFromDatastoreSimpleOrMemcache(c, AddressStr, add, AddressStr+add, address)
	if err!=nil {
		c.Errorf("Address - LoadAddress error 1 - "+err.Error())
		return nil, err
	}
	return address, nil
}

func SaveAddress(c appengine.Context, address *Address) error {
	_, err:=Datastore.PutInDatastoreSimpleAndMemcache(c, AddressStr, address.Address, AddressStr+address.Address, address)
	if err!=nil {
		c.Errorf("Address - SaveAddress error 1 - "+err.Error())
	}
	return err
}

About

An improved way of handling calls to App Engine's Datastore and Memcache

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages