Skip to content
Simplified wrapper for NoSQL databases, including MongoDB and DynamoDB
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd/nosql-importer
nosql
AUTHORS
CONTRIBUTING.md
LICENSE
README.md

README.md

go-nosql

Description

go-nosql is a simplified wrapper for NoSQL databases that provides a common API interface. As it is a simplified wrapper, it cannot cover all database-specific features. Each database wrapped implements the NOSQLBackend interface. DynamoDB and MongoDB are currently supported.

Struct Table is used when calling CreateTables as DynamoDB requires defining Global Secondary Indexes. Each attribute is assumed to be a string.

Table === MongoDB Collection for the purposes of this API.

type Table struct {
  Name string
  Indexes []string
}

Installation

go get github.com/spatialcurrent/go-nosql

Usage

Import

import (
  "github.com/spatialcurrent/go-nosql/nosql"
)

Local DynamoDB

backend = &nosql.BackendDynamoDB{}
err := backend.Connect(map[string]string{
  "AWSDefaultRegion": "us-west-1",
  "StorefrontDynamoDBUrl": "http://localhost:8082",
})

Remote DynamoDB

backend = &nosql.BackendDynamoDB{}
err := backend.Connect(map[string]string{
  "AWSAccessKeyId": "",
  "AWSSecretAccessKey": "",
  "AWSSessionToken": "",
  "AWSDefaultRegion": "us-west-1",
})

MongoDB

backend = &nosql.BackendMongoDB{}
err := backend.Connect(map[string]string{
  "DatabaseUri": "localhost",
  "DatabaseName": "main",
  "Limit": "1000",
})

API

See Backend.go for the public APIs for each backend.

Contributing

Spatial Current, Inc. is currently accepting pull requests for this repository. We'd love to have your contributions! Please see Contributing.md for how to get started.

License

This work is distributed under the MIT License. See LICENSE file.

You can’t perform that action at this time.