Giter Site home page Giter Site logo

leobcn / gostore Goto Github PK

View Code? Open in Web Editor NEW

This project forked from osiloke/gostore

0.0 3.0 0.0 77 KB

GoStore is a small but powerful storage interface for nosql/some rdbms* databases like RethinkDb, boltdb, leveldb, riak, mongodb, postgres* etc.

License: MIT License

Go 100.00%

gostore's Introduction

GoStore is your applications data swiss knife

Build Status GoDoc

GoStore is an application storage tool used to speed up your application development. It makes it easier to mix and match existing nosql/some rdbms* databases like RethinkDb, boltdb, leveldb, riak, mongodb, postgres* etc into your application. It attempts to create a simple way to use different combinations of storage backends in an api. The idea is to standardize high level database operations that are common to every application.

*RDBMS support is still experimental

Features:

  • Support go1.3+
  • Generalized api for accessing multiple types of databases
  • Uses best practices for manipulating data tailored to each type of database
  • Application level filtering for databases that dont support filtering (BoltDB)
  • Semantic easily understandable api to perform application store actions

Still being developed, so the api will change, but don't be afraid to post an issue. I use this in an existing project anyway.

Supported Databases

Eventually Supported Databases

  • CockroachDb
  • MongoDB
  • Aerospike
  • Couch

Usage

$ go get github.com/osiloke/gostore

Gostore tries to simplify your database needs by providing simple specific highlevel database actions which are common to most applications. These actions form the api and are listed below

#####Using a store

import (
	"github.com/osiloke/gostore"
)
//Create a rethinkdb backed store called app
store, _ := gostore.NewRethinkObjectStoreAndSession("localhost:28015", "app")

//Now create the db
store.CreateDatabase()

//Create the table you want to use, you can pass an optional schema 
//to do some advanced stuff
store.CreateTable("things", nil)

//now for profit, tables are accessed by name

//Save a thing which returns the stored key
key, _ := store.Save("things", map[string]interface{}{"name":"one thing", "kind": "table"})

//Or just save all things
keys, _ := store.SaveAll("things", []interface{}{
	map[string]interface{}{"name": "First Thing", "kind": "chair"},
	map[string]interface{}{"name": "Second Thing", "kind": "cup"},
})
keys = append(keys, key)
//Now we can retrieve a thing
var thing map[string]interface{}
store.Get(key, "things", &thing)

println(thing)

Api

####Database Operations

  • CreateDatabase - Creates the database
  • CreateTable - Creates a table/container/collection in a database
  • GetStore - This returns a reference to the stores session
  • Stats - Gets some stats on the database
  • Close - Closes the database, essentially closing the session

####Retrieval

  • All
  • AllCursor
  • AllWithinRange
  • Get

####Creation and Updates

  • Save
  • SaveAll
  • Update
  • Replace
  • Delete

####Filtering

  • Since
  • Before
  • FilterSince
  • FilterBefore
  • FilterBeforeCount
  • FilterUpdate
  • FilterReplace
  • FilterGet
  • FilterGetAll
  • FilterDelete
  • BatchFilterDelete
  • FilterCounts
  • GetByField
  • GetByFieldsByField

Testing

This project uses goconvey for testing but you can run tests like any other go project

go test -v

Testing rethinkdb store requires a running rethink server. This will be updated to use a mock rethinkdb in a few days after which this comment will be removed

Contributors

Contributors on GitHub

License

Version

  • Version 0.1

Contact

Developer/Company

Flattr this git repo

gostore's People

Contributors

osiloke avatar

Watchers

James Cloos avatar Leo Palomares avatar  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.