Code Monkey home page Code Monkey logo

go-aedstorm's Introduction

GoDoc Build Status codecov

This is an ORM like package which makes working with App Engine datastore entities in go a bit easier. The name aedstorm stands for App Engine DataSTore ORM.

It makes working with the datastore and basic data structs quite simple.

Example

import (
	"encoding/json"
	"net/http"

	"google.golang.org/appengine"
	aedstorm "github.com/rubanbydesign/go-aedstorm"
)

type MyData struct {
	ID, Value string
}

func myHandler(w http.ResponseWriter, r *http.Request) {

	ctx := appengine.NewContext(r)

	// Save a new entity.
	d := &MyData{ID: "foo", Value: "bar"}
	if err := aedstorm.NewModel(&d).WithContext(ctx).Save(); err != nil {
		http.Error(w, err.Error(), 500)
		return
	}

	dd := &MyData{ID: "foo"}
	if err := aedstorm.NewModel(&dd).WithContext(ctx).Load(); err != nil {
		http.Error(w, err.Error(), 500)
		return
	}

	// dd.Value  will now equal d.Value after the load.
	w.Header.Set("Content-Type", "application/json")
	json.NewEncoder(w).Encode(&dd)
}

I'm planning on adding more documentation in the future, including some more advanced interfaces which you can implement on a model, and queries, but for now this should give you an idea how easy it is to get going.

Planned improvements

  • Better documentation, more basic examples
  • More documentation around current interfaces which can be implemented
  • Add support for loading/saving related entities

go-aedstorm's People

Contributors

al-faw avatar padurean avatar

Watchers

James Cloos avatar

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.