Giter VIP home page Giter VIP logo

go-store's Introduction

go-store

CircleCI codecov

A storage interface used to do key value data storage. Gives you the freedom to swap out storage implementations without any hassel. Also allows DI and mocking.

Interface

The store intereface defines the following methods

DeleteKey(key string) error
GetString(key string) (string, error)
GetInt64(key string) (int64, error)
Set(key string, value interface{}) error
SetHash(key string, hash string, value interface{}) error
DeleteHash(key string, hash string) error
GetHashString(key string, hash string) (string, error)
GetAllHashValues(key string) ([]string, error)
GetAllHashKeys(key string) ([]string, error)
SetExpiry(key string, seconds int) error
Increment(key string) error
Decrement(key string) error
SetAdd(key string, value interface{}) error
GetSetStringMembers(key string) ([]string, error)
SetRemove(key string, value interface{}) error
SetIsMember(key string, value interface{}) (bool, error)
PushItemToList(key string, value interface{}, atEnd bool) error
PopItemFromList(key string, dataType int, atEnd bool) (interface{}, error)
ItemsFromList(key string, dataType int, start, end int) (interface{}, error)
RemoveItemFromList(key string, count int, value interface{}) error
LengthOfList(key string) (int, error)
ClearDataStore()

Usage

Use the interface declaration in your code where you want to use the data store. You can intialize the store with anything that implements that store. Current implementation only supports Redis but can be easily implemented for any other key/value based data storage such as Bolt DB.

go-store's People

Contributors

awkhan avatar

Watchers

 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.