REST Layer Google Datastore resource storage handler
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

REST Layer Google Datastore Backend

godoc license build

This REST Layer resource storage backend stores data in a Google Datastore using datastore.

This backend used cmorent/rest-layer-datastore as a base and borrows structure and approach from rs/rest-layer-mongo. It uses the general library rather than specific appengine library.


import ""

Or use for a more stable v1 release

import ""

Create a datastore client

ctx := context.Background()
client, err := datastore.NewClient(ctx, "project-id")
if err != nil {
	log.Fatalf("Error connecting to Datastore: %s", err)

Then use this to create a new Handler for your resource binds

// params for the handler
namespace := "default"
entity := "users"
// bind the users resource with the datastore handler
index.Bind("users", user, datastore.NewHandler(client, namespace, entity), resource.DefaultConf)

You can also set a number of Datastore properties which you would like to exclude from being indexed with SetNoIndexProperties on your handler struct.

// create a handler for the resource.
index.Bind("users", user, datastore.NewHandler(client, namespace, entity).SetNoIndexProperties([]string{"prop1", "prop2"}), resource.DefaultConf)

Supported filter operators

  • $and
  • $or
  • $lt
  • $lte
  • $gt
  • $gte
  • $in
  • $nin
  • $exists