https://github.com/reddec/storages
Collection of key-value storages adapters for Golang
https://github.com/reddec/storages
Last synced: 12 months ago
JSON representation
Collection of key-value storages adapters for Golang
- Host: GitHub
- URL: https://github.com/reddec/storages
- Owner: reddec
- License: mit
- Created: 2018-09-30T07:18:10.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-02-14T15:27:26.000Z (over 3 years ago)
- Last Synced: 2025-07-02T11:02:03.833Z (12 months ago)
- Language: Go
- Homepage: https://reddec.github.io/storages/
- Size: 166 KB
- Stars: 18
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Collection of storages (and wrappers)
[](https://reddec.github.io/storages/)
[](https://github.com/reddec/storages)
[](http://godoc.org/github.com/reddec/storages)
[](http://reddec.net/about/#donate)
Different implementations of storages with same abstract interface:
```go
// Thread-safe storage for key-value
type Storage interface {
// Put single item to storage. If already exists - override
Put(key []byte, data []byte) error
// Get item from storage. If not exists - os.ErrNotExist (implementation independent)
Get(key []byte) ([]byte, error)
// Delete key and value
Del(key []byte) error
// Iterate over all keys. Modification during iteration may cause undefined behaviour (mostly - dead-lock)
Keys(handler func(key []byte) error) error
// Close storage if needs
io.Closer
}
```
See [documentation](https://reddec.github.io/storages/) for details
**one more example...**
You can create different storage types just by URL (if you imported required package):
For example, use Redis db as a backend
```go
storage, err := std.Create("redis://localhost")
if err != nil {
panic(err)
}
defer storage.Close()
```
# CLI tools
### Binary
Look to releases section
### Debian/Ubuntu
[](https://bintray.com/reddec/storages-debian/storages/_latestVersion)
Add public Bintray key
```bash
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 379CE192D401AB61
```
#### Add repository
* supported distribution: trusty, xenial, bionic, buster, wheezy
```bash
echo "deb https://dl.bintray.com/reddec/debian {distribution} main" | sudo tee -a /etc/apt/sources.list
```
**Ubuntu 18.04 (bionic)**
```bash
echo "deb https://dl.bintray.com/reddec/debian bionic main" | sudo tee -a /etc/apt/sources.list
```
**Ubuntu 16.04 (xenial)**
```bash
echo "deb https://dl.bintray.com/reddec/debian xenial main" | sudo tee -a /etc/apt/sources.list
```
#### Update cache
`sudo apt-get update`
### Install
`sudo apt-get install storages`
### Build from source
* requires Go 1.13+
`go get github.com/reddec/storages/cmd/...`
# License
The wrappers itself licensed under MIT but used libraries may have different license politics.