Datastore

package
v0.0.0-...-8b651fe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const FakeBlobstoreBucket = "FakeBlobstore"
View Source
const MaxDataToStore int = 1000000 //<2**20 to fit into datastore

Variables

This section is empty.

Functions

func ClearNamespace

func ClearNamespace(c context.Context, kind string) error

func ClearNamespaceAndMemcache

func ClearNamespaceAndMemcache(c context.Context, kind string) error

func CountQueryWithFilter

func CountQueryWithFilter(c context.Context, kind string, filterStr string, filterValue interface{}) int

func DeleteFromBlobstore

func DeleteFromBlobstore(c context.Context, blobkey appengine.BlobKey) error

func DeleteFromDatastoreFull

func DeleteFromDatastoreFull(c context.Context, kind, stringID string, intID int64, parent *datastore.Key) error

func DeleteFromDatastoreSimple

func DeleteFromDatastoreSimple(c context.Context, kind, stringID string) error

func DeleteFromDatastoreSimpleAndMemcache

func DeleteFromDatastoreSimpleAndMemcache(c context.Context, kind, stringID, memcacheID string) error

func DeleteFromMemcache

func DeleteFromMemcache(c context.Context, memcacheID string)

func FlushMemcache

func FlushMemcache(c context.Context) error

func GetFromBlobstore

func GetFromBlobstore(c context.Context, blobkey appengine.BlobKey, dst interface{}) (interface{}, error)

//TODO: fix

func PutInBlobstore(c context.Context, toStore interface{}) (appengine.BlobKey, error) {
	//TODO: check capabilities
	var k appengine.BlobKey
	var data bytes.Buffer
	enc := gob.NewEncoder(&data)
	err := enc.Encode(toStore)
	if err != nil {
		Log.Errorf(c, "PutInBlobstore - %s", err)
		return k, err
	}

	w, err := blobstore.Create(c, "application/octet-stream")
	if err != nil {
		Log.Errorf(c, "PutInBlobstore - %s", err)
		return k, err
	}
	_, err = w.Write(data.Bytes())
	if err != nil {
		Log.Errorf(c, "PutInBlobstore - %s", err)
		return k, err
	}
	err = w.Close()
	if err != nil {
		Log.Errorf(c, "PutInBlobstore - %s", err)
		return k, err
	}
	k, err = w.Key()
	if err != nil {
		Log.Errorf(c, "PutInBlobstore - %s", err)
	}
	return k, err
}

func GetFromDatastoreFull

func GetFromDatastoreFull(c context.Context, kind, stringID string, intID int64, parent *datastore.Key, dst interface{}) error

func GetFromDatastoreOrSetDefaultFull

func GetFromDatastoreOrSetDefaultFull(c context.Context, kind, stringID string, intID int64, parent *datastore.Key, dst interface{}, def interface{}) error

A function that either loads a variable from datastore, or if it is not present, sets it and then loads it

func GetFromDatastoreOrSetDefaultSimple

func GetFromDatastoreOrSetDefaultSimple(c context.Context, kind, stringID string, dst interface{}, def interface{}) error

func GetFromDatastoreSimple

func GetFromDatastoreSimple(c context.Context, kind, stringID string, dst interface{}) error

func GetFromDatastoreSimpleOrMemcache

func GetFromDatastoreSimpleOrMemcache(c context.Context, kind, stringID, memcacheID string, dst interface{}) error

func GetFromDatastoreSimpleWithParent

func GetFromDatastoreSimpleWithParent(c context.Context, kind, stringID string, parent *datastore.Key, dst interface{}) error

func GetFromFakeBlobstore

func GetFromFakeBlobstore(c context.Context, kind, stringID string, dst interface{}) error

func GetFromMemcache

func GetFromMemcache(c context.Context, key string, dst interface{}) interface{}

func IsVariableInDatastoreSimple

func IsVariableInDatastoreSimple(c context.Context, kind, stringID string, dst interface{}) bool

func IsVariableInDatastoreSimpleOrMemcache

func IsVariableInDatastoreSimpleOrMemcache(c context.Context, kind, stringID, memcacheID string, dst interface{}) bool

func KeysToStringIDs

func KeysToStringIDs(keys []*datastore.Key) []string

func PutInDatastore

func PutInDatastore(c context.Context, kind string, variable interface{}) (*datastore.Key, error)

func PutInDatastoreFull

func PutInDatastoreFull(c context.Context, kind, stringID string, intID int64, parent *datastore.Key, variable interface{}) (*datastore.Key, error)

func PutInDatastoreSimple

func PutInDatastoreSimple(c context.Context, kind, stringID string, variable interface{}) (*datastore.Key, error)

func PutInDatastoreSimpleAndMemcache

func PutInDatastoreSimpleAndMemcache(c context.Context, kind, stringID, memcacheID string, variable interface{}) (*datastore.Key, error)

func PutInDatastoreSimpleWithParent

func PutInDatastoreSimpleWithParent(c context.Context, kind, stringID string, parent *datastore.Key, variable interface{}) (*datastore.Key, error)

func PutInFakeBlobstore

func PutInFakeBlobstore(c context.Context, kind, stringID string, toStore interface{}) error

func PutInMemcache

func PutInMemcache(c context.Context, key string, toStore interface{}) error

func QueryGetAll

func QueryGetAll(c context.Context, kind string, dst interface{}) ([]*datastore.Key, error)

func QueryGetAllKeys

func QueryGetAllKeys(c context.Context, kind string, dst interface{}) ([]*datastore.Key, error)

func QueryGetAllKeysWithFilter

func QueryGetAllKeysWithFilter(c context.Context, kind string, filterStr string, filterValue interface{}, dst interface{}) []*datastore.Key

func QueryGetAllKeysWithFilterAndLimit

func QueryGetAllKeysWithFilterAndLimit(c context.Context, kind string, filterStr string, filterValue interface{}, limit int, dst interface{}) []*datastore.Key

func QueryGetAllKeysWithFilterAndOrder

func QueryGetAllKeysWithFilterAndOrder(c context.Context, kind string, filterStr string, filterValue interface{}, orderStr string, dst interface{}) ([]*datastore.Key, error)

func QueryGetAllKeysWithFilterLimitAndOrder

func QueryGetAllKeysWithFilterLimitAndOrder(c context.Context, kind string, filterStr string, filterValue interface{}, limit int, orderStr string, dst interface{}) ([]*datastore.Key, error)

func QueryGetAllKeysWithFilterLimitOffsetAndOrder

func QueryGetAllKeysWithFilterLimitOffsetAndOrder(c context.Context, kind string, filterStr string, filterValue interface{}, limit int, offset int, orderStr string, dst interface{}) ([]*datastore.Key, error)

func QueryGetAllWithFilter

func QueryGetAllWithFilter(c context.Context, kind string, filterStr string, filterValue interface{}, dst interface{}) ([]*datastore.Key, error)

func QueryGetAllWithFilterAndLimit

func QueryGetAllWithFilterAndLimit(c context.Context, kind string, filterStr string, filterValue interface{}, limit int, dst interface{}) ([]*datastore.Key, error)

func QueryGetAllWithLimit

func QueryGetAllWithLimit(c context.Context, kind string, limit int, dst interface{}) ([]*datastore.Key, error)

func QueryGetFirstBy

func QueryGetFirstBy(c context.Context, kind string, order string, limit int, dst interface{}) ([]*datastore.Key, error)

func QueryGetFirstKeysBy

func QueryGetFirstKeysBy(c context.Context, kind string, order string, limit int, dst interface{}) ([]*datastore.Key, error)

func TestMemcache

func TestMemcache(c context.Context)

Types

type FakeBlobstoreData

type FakeBlobstoreData struct {
	Data []byte `datastore:",noindex"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL