• Stars
    star
    112
  • Rank 301,318 (Top 7 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created about 9 years ago
  • Updated about 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple and fast Redis backed key-value store library for Go

store GoDoc Build Status

store is a data-store library for Go that provides a set of platform-independent interfaces to persist and retrieve data.

Its primary goal is to wrap existing implementations of such primitives, such as those in package redis, into shared public interfaces that abstract functionality, plus some other related primitives.

It currently supports Redis from the redis package.

NOTE: This library is currently under active development and not ready for production use.

Example

The below example stores, lists and fetches the saved records

package main

import (
  "fmt"

  "github.com/gosuri/go-store/redis"
)

type hacker struct {
  Id        string
  Name      string
  Birthyear int
}

func (h *hacker) Key() string {
  return h.Id
}

func (h *hacker) SetKey(k string) {
  h.Id = k
}

func main() {
  store, err := redis.NewStore("", "")
  if err != nil {
    panic(err) // handle error
  }

  // Save a hacker in the store with a auto-generated uuid
  if err := store.Write(&hacker{Name: "Alan Turing", Birthyear: 1912}); err != nil {
    panic(err) // handle error
  }

  var hackers []hacker
  // Populate hackers slice with ids of all hackers in the store
  store.List(&hackers)

  alan := hackers[0]
  store.Read(&alan)
  fmt.Println("Hello,", alan.Name)

  fmt.Println("Listing all", len(hackers), "hackers")
  // Fetches all hackers with names from the store
  store.ReadMultiple(hackers)
  for _, h := range hackers {
    fmt.Printf("%s (%d) (%s)\n", h.Name, h.Birthyear, h.Id)
  }
}

Roadmap

Below are items I am and plan on working on in the near future. Contributions are welcome.

Feature Status
Save multiple records in a single call using pipelining implementing
Query (using finders) and indexing

Contributing

Dependency management

Users who import store into their package main are responsible to organize and maintain all of their dependencies to ensure code compatibility and build reproducibility. Store makes no direct use of dependency management tools like Godep.

We will use a variety of continuous integration providers to find and fix compatibility problems as soon as they occur.

Running Testing

$ make test

Benchmarks

$ make benchmark
...
BenchmarkRedisWrite      10000  104302 ns/op
BenchmarkRead            20000  65870 ns/op
BenchmarkRead1k          20     67325041 ns/op
BenchmarkRedisList1k     50     27598338 ns/op
BenchmarkRedisList10k    30     71845057 ns/op
BenchmarkReadMultiple1k  200    7453783 ns/op

More Repositories

1

uiprogress

A go library to render progress bars in terminal applications
Go
2,062
star
2

uilive

uilive is a go library for updating terminal output in realtime
Go
1,648
star
3

uitable

A go library to improve readability in terminal apps using tabular data
Go
721
star
4

vagrant-env

Vagrant plugin to load environment variables from .env into ENV
Ruby
144
star
5

cmdns

cmdns is a go library for namespacing a command tree
Go
25
star
6

aws-rds-cookbook

Development repository for chef cookbook aws-rds
Ruby
16
star
7

dotfiles

Greg Osuri's dotfiles
Shell
10
star
8

terraform-exec-provider

Go
9
star
9

git-url-sub

git remote url substitution utility
Shell
7
star
10

awesome-sysops

Curated list of awesome tools for systems operators
6
star
11

rails-app-cookbook

Example cookbook using aws-rds cookbook to install rails_app
Ruby
6
star
12

dsky

dsky is a UI framework for terminal applications
Go
5
star
13

monocle

a go library for advanced command line help
Go
5
star
14

multibar

[DEPRICATED] MultiBar is go library to render progress bars in the terminal
Go
5
star
15

Pylearn

Greg Osuri's Python Journey
4
star
16

uiutil

uiutil is a go library that provides a set of helpers to improve readbility in terminal applications
Go
4
star
17

handshake-containers

Makefile
4
star
18

ctxexec

ctxexec is go library that provides helper functions for running context-aware external commands
Go
3
star
19

grumpy

Grumpy cat is a blockchain to honor Grumpy Cat
TypeScript
2
star
20

gosuri.github.io

Source for gregosuri.com
SCSS
2
star
21

aws-vpc-terraform-post

Support files for my airpair post
1
star
22

petit

a simple, fast, rack-based url routing server
Ruby
1
star
23

test-runner

Linux container based test running tools for ruby applications
Shell
1
star
24

ap-workshop-cookbooks

Chef cookbooks for my Airpair containers workshop
Ruby
1
star
25

vanitypkg

vanitypkg provides a server that hosts vanity package names for Go package hosted on github
Go
1
star
26

akt20

1
star
27

hostnamer

Cluster member discovery and registration tool for Route 53
Ruby
1
star
28

knife-ec2-ssh-config

Knife plugin to update ssh client config with ec2 instance information
Ruby
1
star
29

chef-ebs-directory

Chef cookbook for moving a directory to a ebs volume
Ruby
1
star
30

noop

An empty repo used for testing git ops
1
star
31

build-compiler

Container based build tools for Ubuntu 14.04
Shell
1
star
32

nextjs-notes

JavaScript
1
star
33

eve

eve fork
Go
1
star