{"id":15056898,"url":"https://github.com/madflojo/hord","last_synced_at":"2025-04-10T04:56:43.950Z","repository":{"id":54755881,"uuid":"158491780","full_name":"madflojo/hord","owner":"madflojo","description":"Manage data in Go with a simple key-value interface supporting various databases.","archived":false,"fork":false,"pushed_at":"2024-04-21T16:51:53.000Z","size":4222,"stargazers_count":15,"open_issues_count":0,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-01T21:05:51.094Z","etag":null,"topics":["boltdb","cassandra","go","golang","nats","redis"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/madflojo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-21T04:42:17.000Z","updated_at":"2024-05-06T14:04:09.803Z","dependencies_parsed_at":"2023-10-21T19:23:48.168Z","dependency_job_id":"6bb4349b-a5d9-477d-add2-11d88b53f319","html_url":"https://github.com/madflojo/hord","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madflojo%2Fhord","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madflojo%2Fhord/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madflojo%2Fhord/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madflojo%2Fhord/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/madflojo","download_url":"https://codeload.github.com/madflojo/hord/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248161261,"owners_count":21057554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["boltdb","cassandra","go","golang","nats","redis"],"created_at":"2024-09-24T21:57:57.113Z","updated_at":"2025-04-10T04:56:43.926Z","avatar_url":"https://github.com/madflojo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hord\n\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/madflojo/hord)\n[![codecov](https://codecov.io/gh/madflojo/hord/branch/main/graph/badge.svg?token=0TTTEWHLVN)](https://codecov.io/gh/madflojo/hord)\n[![Go Report Card](https://goreportcard.com/badge/github.com/madflojo/hord)](https://goreportcard.com/report/github.com/madflojo/hord)\n[![Documentation](https://godoc.org/github.com/madflojo/hord?status.svg)](http://godoc.org/github.com/madflojo/hord)\n\n## This repository has moved to \u003chttps://github.com/tarmac-project/hord\u003e\n\nPlease use the new repository and update any references to this repository.\n\n## Overview\n\nPackage hord provides a simple and extensible interface for interacting with various database systems in a uniform way.\n\nHord is designed to be a database-agnostic library that provides a common interface for interacting with different database systems. It allows developers to write code that is decoupled from the underlying database technology, making it easier to switch between databases or support multiple databases in the same application.\n\n## Features\n\n- **Driver-based**: Hord follows a driver-based architecture, where each database system is implemented as a separate driver. This allows for easy extensibility to support new databases.\n- **Uniform API**: Hord provides a common API for database operations, including key-value operations, setup, and configuration. The API is designed to be simple and intuitive.\n- **Pluggable**: Developers can choose and configure the desired database driver based on their specific needs.\n- **Error handling**: Hord provides error types and constants for consistent error handling across drivers.\n- **Testing with Mock Driver**: Hord provides a mock driver in the `mock` package, which can be used for testing purposes. The `mock` driver allows users to define custom functions executed when calling the `Database` interface methods, making it easier to test code that relies on the Hord interface.\n- **Documentation**: Each driver comes with its own package documentation, providing guidance on how to use and configure the driver.\n\n### Evolving Features\n\n- **Cache Implementations**: Combine database drivers with pre-defined cache implementations.\n\n## Database Drivers:\n\n| Database | Support | Comments | Protocol Compatible Alternatives |\n| -------- | ------- | -------- | -------------------------------- |\n| [BoltDB](https://github.com/etcd-io/bbolt) | ✅ | | |\n| [Cassandra](https://cassandra.apache.org/) | ✅ | | [ScyllaDB](https://www.scylladb.com/), [YugabyteDB](https://www.yugabyte.com/), [Azure Cosmos DB](https://learn.microsoft.com/en-us/azure/cosmos-db/introduction) |\n| Hashmap | ✅ | Optionally allows storing to YAML or JSON file ||\n| Mock | ✅ | Mock Database interactions within unit tests ||\n| [NATS](https://nats.io/) | ✅ | Experimental ||\n| [Redis](https://redis.io/) | ✅ || [Dragonfly](https://www.dragonflydb.io/), [KeyDB](https://docs.keydb.dev/) |\n\n## Caching Implementations\n\n| Cache Strategy | Comments |\n| -------------- | -------- |\n| Look Aside | Cache is checked before database, if not found in cache, database is checked and cache is updated |\n\n## Usage\n\nTo use Hord, import it as follows:\n\n    import \"github.com/madflojo/hord\"\n\n### Creating a Database Client\n\nTo create a database client, you need to import and use the appropriate driver package along with the `hord` package.\n\nFor example, to use the Redis driver:\n\n```go\nimport (\n    \"github.com/madflojo/hord\"\n    \"github.com/madflojo/hord/redis\"\n)\n\nfunc main() {\n    var db hord.Database\n    db, err := redis.Dial(redis.Config{})\n    if err != nil {\n        // Handle connection error\n    }\n\n    // Use the db client for database operations\n    // ...\n}\n```\n\nEach driver provides its own `Dial` function to establish a connection to the database. Refer to the specific driver documentation for more details.\n\n### Database Operations\n\nOnce you have a database client, you can use it to perform various database operations. The API is consistent across different drivers.\n\n```go\n// Set a value\nerr = db.Set(\"key\", []byte(\"value\"))\nif err != nil {\n    // Handle error\n}\n\n// Retrieve a value\nvalue, err := db.Get(\"key\")\nif err != nil {\n    // Handle error\n}\n```\n\nRefer to the `hord.Database` interface documentation for a complete list of available methods.\n\n## Contributing\nThank you for your interest in helping develop Hord. The time, skills, and perspectives you contribute to this project are valued.\n\nPlease reference our [Contributing Guide](CONTRIBUTING.md) for details.\n\n## License\n[Apache License 2.0](https://choosealicense.com/licenses/apache-2.0/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadflojo%2Fhord","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmadflojo%2Fhord","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadflojo%2Fhord/lists"}