Coder Social home page Coder Social logo

rest-layer-datastore's Introduction

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.

Usage

import "github.com/ajcrowe/rest-layer-datastore"

Or use gopkg.in for a more stable v1 release

import "gopkg.in/ajcrowe/rest-layer-datastore.v1"

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

rest-layer-datastore's People

Contributors

elias-winberg avatar ingkagero avatar ajcrowe avatar ultimateboy avatar rs avatar

Forkers

amirbadnjevic

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.