Hord provides a modular key-value interface for interacting with databases in Go

Hord

Build Status GitHub go.mod Go version Coverage Status Go Report Card Documentation

Hord provides a modular key-value interface for interacting with databases. The goal is to provide a consistent interface regardless, of the underlying database.

With this package, users can switch out the underlying database without major refactoring.

Installation

To use Hord within your project you must first import the Hord interface itself.

import "github.com/madflojo/hord"

Then import the database driver you wish to use

import "github.com/madflojo/hord/driver/cassandra"

Available drivers are a follows:

  • Cassandra
  • Redis

Our TODO list:

  • Couchbase
  • CockRoachDB
  • MySQL
  • TiKV
  • PostgreSQL

Usage

The below example shows using Hord to connect and interact with Cassandra.

import "github.com/madflojo/hord"
import "github.com/madflojo/hord/driver/cassandra"

func main() {
  // Define our DB Interface
  var db hord.Database

  // Connect to a Cassandra Cluster
  db, err := cassandra.Dial(&cassandra.Config{})
  if err != nil {
    // do stuff
  }

  // Setup and Initialize the Keyspace if necessary
  err = db.Setup()
  if err != nil {
    // do stuff
  }

  // Write data to the cluster
  err = db.Set("mykey", []byte("My Data"))
  if err != nil {
    // do stuff
  }

  // Fetch the same data
  d, err := db.Get("mykey")
  if err != nil {
    // do stuff
  }
}

Contributing

Thank you for your interest in helping develop Hord. The time, skills, and perspectives you contribute to this project are valued.

Please reference our Contributing Guide for details.

License

Apache License 2.0

Owner
Benjamin Cane
Thoughts and opinions are my own.
Benjamin Cane
Comments
  • Support data access via HTTPS

    Support data access via HTTPS

    Describe the solution you'd like It would be nice to be able to query Hord via REST calls as there may be cases where gRPC doesn’t fit with the clients needs.

    Additional context

    Ideally a HTTP requests should map as

    • Get > Get
    • Post > Set
    • Put > Set
    • Delete > Delete

    The controls type should also be JSON.

  • Need Benchmarks for Cassandra Driver

    Need Benchmarks for Cassandra Driver

    Describe the idea

    One thing folks are going to wonder, is how efficient is Hord. Best way to do that is to write some Benchmark tests and publish the results in the README.

    Describe possible implementations

    Write some benchmarks for various data sizes.

  • Add contributing guide

    Add contributing guide

    Description

    This PR adds a CONTRIBUTING.md file. I'm new to Golang, so I've taken a first crack at the steps you'd like folks to follow to contribute to this repo, but I'm sure there will be a number of things that I've missed.

    Fixes #7

    Type of change

    Documentation change

    Checklist:

    • [N/A] I have performed a self-review of my own code
    • [N/A] I have commented my code, ensuring GoDoc readability and clarity in hard-to-understand areas
    • [X] I have made corresponding changes to documentation
    • [N/A] I have added tests that ensure my fix is effective or that my feature works
    • [N/A] Any dependent changes have been merged and published in downstream modules

    If checklist items are unchecked please explain.

    This change only includes a documentation update.

  • Secure authentication for gRPC and HTTP based requests

    Secure authentication for gRPC and HTTP based requests

    Describe the idea

    Hord needs to secure data to only those who should be creating/reading data. Ideally this should follow typical gRPC and HTTP authentication methods.

    Describe possible implementations

    At this point it seems that JWT and 2-way TLS are the most preferred solutions. Thought I think this needs a full design proposal including how authentication tokens should be managed within Hord.

    Additional context

    I do think that it makes sense to support multiple users/tokens and provide different privileges based on the user/token.

  • Create a CLI client for Hord

    Create a CLI client for Hord

    Is your feature request related to a problem? Please describe. There is currently no way to query data or admin hord instances from command line.

    Describe the solution you'd like I think having a simple CLI as part of the hord package would be key. This CLI would be able to query using gRPC and admin Hord via a Admin API.

    Additional context My first thoughts are querying and admin functions but I think it would make sense for someone to propose a design via this issue before implementing.

  • Update errors , fix panic if db was not configured

    Update errors , fix panic if db was not configured

    Description

    Adding if statement to check if db is nil , this is fixing the panic in testcases and also if one of the function related to db called

    Organizing the error messages in app.go and grpc,go /TODO/ the error organization needs a little more work so all the errors are following the same format and/or be more centralized

    Fixes # (issue)

    Fix Panic in testcases caused by db==nil

    Type of change

    Please delete options that are not relevant.

    • [x] Bug fix (non-breaking change which fixes an issue)

    Checklist:

    • [x] I have performed a self-review of my own code
    • [x] I have commented my code, ensuring GoDoc readability and clarity in hard-to-understand areas
    • [x] I have made corresponding changes to documentation
    • [-] I have added tests that ensure my fix is effective or that my feature works
    • [-] Any dependent changes have been merged and published in downstream modules

    If checklist items are unchecked please explain.

    adding test was not needed changing dependencies was not needed

  • Adding a Mock Driver for Testing

    Adding a Mock Driver for Testing

    Description

    This change adds a Mock database driver that applications can use for testing. This driver works by having a set of predefined happy path answers. However, users can also set up custom functions to be executed and returned in place of the happy path values.

    Type of change

    Please delete options that are not relevant.

    • [X] New feature (non-breaking change which adds functionality)
    • [X] This change requires a documentation update

    Checklist:

    • [X] I have performed a self-review of my own code
    • [X] I have commented my code, ensuring GoDoc readability and clarity in hard-to-understand areas
    • [X] I have made corresponding changes to documentation
    • [X] I have added tests that ensure my fix is effective or that my feature works
    • [X] Any dependent changes have been merged and published in downstream modules

    If checklist items are unchecked please explain.

  • Moving common errors to main package

    Moving common errors to main package

    Description

    This change has a few minor documentation updates, a Makefile but more importantly, it changes how errors are created. Rather than having package-specific errors, this change introduces common errors within the Hord package.

    Type of change

    Please delete options that are not relevant.

    • [X] New feature (non-breaking change which adds functionality)
    • [X] This change requires a documentation update

    Checklist:

    • [X] I have performed a self-review of my own code
    • [X] I have commented my code, ensuring GoDoc readability and clarity in hard-to-understand areas
    • [X] I have made corresponding changes to documentation
    • [X] I have added tests that ensure my fix is effective or that my feature works
    • [X] Any dependent changes have been merged and published in downstream modules

    If checklist items are unchecked please explain.

  • Benchmarks and Fixing up some Tech Debt

    Benchmarks and Fixing up some Tech Debt

    Description

    Adding Benchmarks to the Travis build process.

    Type of change

    Please delete options that are not relevant.

    • [X] New feature (non-breaking change which adds functionality)

    Checklist:

    • [X] I have performed a self-review of my own code
    • [X] I have commented my code, ensuring GoDoc readability and clarity in hard-to-understand areas
    • [X] I have made corresponding changes to documentation
    • [X] I have added tests that ensure my fix is effective or that my feature works
    • [X] Any dependent changes have been merged and published in downstream modules

    If checklist items are unchecked please explain.

  • Whoops forgot package docs

    Whoops forgot package docs

    Description

    I somehow forgot Package Docs

    Type of change

    Please delete options that are not relevant.

    • [X] New feature (non-breaking change which adds functionality)

    Checklist:

    • [X] I have performed a self-review of my own code
    • [X] I have commented my code, ensuring GoDoc readability and clarity in hard-to-understand areas
    • [X] I have made corresponding changes to documentation
    • [X] I have added tests that ensure my fix is effective or that my feature works
    • [X] Any dependent changes have been merged and published in downstream modules

    If checklist items are unchecked please explain.

  • Adding a Redis Driver

    Adding a Redis Driver

    Description

    This pull request adds a Redis driver for Hord. This driver supports both open source and enterprise Redis using Sentinel/Discovery Service. At the moment the driver only supports the Hord specific interface but it could easily be extended to enable additional functions.

    Type of change

    Please delete options that are not relevant.

    • [X] New feature (non-breaking change which adds functionality)

    Checklist:

    • [X] I have performed a self-review of my own code
    • [X] I have commented my code, ensuring GoDoc readability and clarity in hard-to-understand areas
    • [X] I have made corresponding changes to documentation
    • [X] I have added tests that ensure my fix is effective or that my feature works
    • [X] Any dependent changes have been merged and published in downstream modules

    If checklist items are unchecked please explain.

  • NATS KV driver

    NATS KV driver

    Describe the idea

    NATS has explicit KV support.

    Describe possible implementations

    here is one already: https://github.com/HeavyHorst/easykv/tree/master/nats

    Additional context

    NATS KV also has watch, so you can get an event what a KV item changes.

🐺 Deploy Databases and Services Easily for Development and Testing Pipelines.
🐺 Deploy Databases and Services Easily for Development and Testing Pipelines.

Peanut provides an API and a command line tool to deploy and configure the commonly used services like databases, message brokers, graphing tools ... etc. It perfectly suited for development, manual testing, automated testing pipelines where mocking is not possible and test drives.

Jan 3, 2023
Go driver for PostgreSQL over SSH. This driver can connect to postgres on a server via SSH using the local ssh-agent, password, or private-key.

pqssh Go driver for PostgreSQL over SSH. This driver can connect to postgres on a server via SSH using the local ssh-agent, password, or private-key.

Nov 6, 2022
GoBigdis is a persistent database that implements the Redis server protocol. Any Redis client can interface with it and start to use it right away.

GoBigdis GoBigdis is a persistent database that implements the Redis server protocol. Any Redis client can interface with it and start to use it right

Apr 27, 2022
Tapestry is an underlying distributed object location and retrieval system (DOLR) which can be used to store and locate objects. This distributed system provides an interface for storing and retrieving key-value pairs.

Tapestry This project implements Tapestry, an underlying distributed object location and retrieval system (DOLR) which can be used to store and locate

Mar 16, 2022
A simple golang api generator that stores struct fields in key/value based databases

Backgen A simple golang API generator that uses key/value based databases. It does not provide the database itself, only uses a interface to access se

Feb 4, 2022
Modular Kubernetes operator to manage the lifecycle of databases

Ensemble Ensemble is a simple and modular Kubernetes Operator to manage the lifecycle of a wide range of databases. Infrastructure as code with Kubern

Aug 12, 2022
Kivik provides a common interface to CouchDB or CouchDB-like databases for Go and GopherJS.

Kivik Package kivik provides a common interface to CouchDB or CouchDB-like databases. The kivik package must be used in conjunction with a database dr

Dec 29, 2022
Nipo is a powerful, fast, multi-thread, clustered and in-memory key-value database, with ability to configure token and acl on commands and key-regexes written by GO

Welcome to NIPO Nipo is a powerful, fast, multi-thread, clustered and in-memory key-value database, with ability to configure token and acl on command

Dec 28, 2022
A key-value db api with multiple storage engines and key generation
A key-value db api with multiple storage engines and key generation

Jet is a deadly-simple key-value api. The main goals of this project are : Making a simple KV tool for our other projects. Learn tests writing and git

Apr 5, 2022
pure golang key database support key have value. 非常高效实用的键值数据库。
pure golang key database support key have value.  非常高效实用的键值数据库。

orderfile32 pure golang key database support key have value The orderfile32 is standard alone fast key value database. It have two version. one is thi

Apr 30, 2022
Simple CLI interface to in-memory key/value storage a la redis.

Simple memory key value Simple CLI interface to in-memory key/value storage a la redis. Running Can be run through go directly or through docker using

Jan 7, 2022
A project that provides an in-memory key-value store as a REST API. Also, it's containerized and can be used as a microservice.

Easy to Use In-Memory Key-Value Store A project that provides an in-memory key-value store as a REST API. Also, it's containerized and can be used as

Mar 6, 2022
Go network programming framework, supports multiplexing, synchronous and asynchronous IO mode, modular design, and provides flexible custom interfaces
Go network programming framework, supports multiplexing, synchronous and asynchronous IO mode, modular design, and provides flexible custom interfaces

Go network programming framework, supports multiplexing, synchronous and asynchronous IO mode, modular design, and provides flexible custom interfaces。The key is the transport layer, application layer protocol has nothing to do

Nov 7, 2022
Uniform interface for interacting with network hardware via telnet/ssh

jgivc/console This package provides a uniform interface for interacting with network hardware via telnet/ssh This package uses part of reiver/go-telne

Dec 9, 2021
Tabouli: a TUI for interacting with firmware/embedded devices that support a CLI via serial interface/virtual COM Port
Tabouli: a TUI for interacting with firmware/embedded devices that support a CLI via serial interface/virtual COM Port

Tabouli Information Tabouli is a TUI for interacting with firmware/embedded devi

Apr 2, 2022
Universal command-line interface for SQL databases

usql A universal command-line interface for PostgreSQL, MySQL, Oracle Database, SQLite3, Microsoft SQL Server, and many other databases including NoSQ

Jan 9, 2023
sq is a command line tool that provides jq-style access to structured data sources such as SQL databases, or document formats like CSV or Excel.

sq: swiss-army knife for data sq is a command line tool that provides jq-style access to structured data sources such as SQL databases, or document fo

Jan 1, 2023
Package pbpgx provides a toolkit for easier Protocol Buffers interaction with PostgreSQL databases.

PBPGX Package pbpgx provides a toolkit for easier Protocol Buffers interaction with PostgreSQL databases. Pbpgx supports the Protocol Buffer types gen

Jun 27, 2022
:steam_locomotive: Decodes url.Values into Go value(s) and Encodes Go value(s) into url.Values. Dual Array and Full map support.

Package form Package form Decodes url.Values into Go value(s) and Encodes Go value(s) into url.Values. It has the following features: Supports map of

Dec 26, 2022