ProductPromotion
Logo

Go.Lang

made by https://0x3d.site

GitHub - gosuri/go-store: A simple and fast Redis backed key-value store library for Go
A simple and fast Redis backed key-value store library for Go - gosuri/go-store
Visit Site

GitHub - gosuri/go-store: A simple and fast Redis backed key-value store library for Go

GitHub - gosuri/go-store: 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

Articles
to learn more about the golang concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

Queries
or most google FAQ's about GoLang.

mail [email protected] to add more queries here ๐Ÿ”.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory