{"id":22387646,"url":"https://github.com/bay0/kvs","last_synced_at":"2025-07-04T00:05:17.263Z","repository":{"id":65950320,"uuid":"603081907","full_name":"bay0/kvs","owner":"bay0","description":"kvs is a simple key-value store library for Go.","archived":false,"fork":false,"pushed_at":"2023-02-19T17:28:24.000Z","size":29,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-04T00:03:42.278Z","etag":null,"topics":["go","key-value-store","kvs","memory","module","package","sharding"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/bay0/kvs","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bay0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"2023-02-17T15:24:52.000Z","updated_at":"2024-11-20T21:18:46.000Z","dependencies_parsed_at":"2023-05-16T09:45:43.718Z","dependency_job_id":null,"html_url":"https://github.com/bay0/kvs","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/bay0/kvs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bay0%2Fkvs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bay0%2Fkvs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bay0%2Fkvs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bay0%2Fkvs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bay0","download_url":"https://codeload.github.com/bay0/kvs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bay0%2Fkvs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263421884,"owners_count":23464046,"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":["go","key-value-store","kvs","memory","module","package","sharding"],"created_at":"2024-12-05T02:10:17.846Z","updated_at":"2025-07-04T00:05:17.173Z","avatar_url":"https://github.com/bay0.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kvs\n\nkvs is a simple key-value store library for Go.\n\nIt offers the following functionality:\n\n* Get: retrieve a value associated with a given key from the store\n* Set: add or update a key-value pair in the store\n* Delete: remove a key-value pair associated with a given key from the store\n* Keys: retrieve a slice of all the keys in the store\n\nThis library defines two interfaces:\n\n`Value` which defines the methods a value in the key-value store must implement\n\n`Store` which defines the methods that a key-value store must implement\n\n`ErrCode` defines an enumeration that represents the error codes that can be returned by the store.\n\nThe error codes are:\n\n* `ErrUnknown`: represents an unknown error\n* `ErrNotFound`: represents an error that occurs when the key is not found in the store\n* `ErrDuplicate`: represents an error that occurs when the key already exists in the store\n\n## Installation\n\nUse `go get` to install kvs.\n\n```bash\ngo get github.com/bay0/kvs\n```\n\n## Usage\n\nTo use the library, import the kvs package and create a new instance of the KeyValueStore using NewKeyValueStore().\n\n```go\npackage main\n\nimport (\n \"fmt\"\n\n \"github.com/bay0/kvs\"\n)\n\ntype Person struct {\n Name string\n Age  int\n}\n\nfunc (p *Person) Clone() kvs.Value {\n return \u0026Person{\n  Name: p.Name,\n  Age:  p.Age,\n }\n}\n\nfunc main() {\n // Create a new key-value store with sharding enabled\n store := kvs.NewKeyValueStore(2)\n\n // Create a new person value\n person := \u0026Person{\n  Name: \"John\",\n  Age:  20,\n }\n\n // Set the person value in the store\n err := store.Set(\"person\", person)\n if err != nil {\n  // Handle the error\n }\n\n // Get the person value from the store\n val, err := store.Get(\"person\")\n if err != nil {\n  // Handle the error\n }\n\n // Cast the value to a person object\n personVal, ok := val.(*Person)\n if !ok {\n  // Handle the error\n }\n\n // Print the person's name and age\n fmt.Printf(\"%s is %d years old.\\n\", personVal.Name, personVal.Age)\n\n // Delete the person value from the store\n err = store.Delete(\"person\")\n if err != nil {\n  // Handle the error\n }\n\n // Get all keys from the store\n keys := store.Keys()\n fmt.Println(\"Keys in the store:\", keys)\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbay0%2Fkvs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbay0%2Fkvs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbay0%2Fkvs/lists"}