💿 In-memory key value store that saves your data to disk using JSON.
10 Commits
.editorconfig | ||
.gitignore | ||
Collection_test.go | ||
Collection.go | ||
go.mod | ||
go.sum | ||
LICENSE | ||
README.md |
ocean
In-memory key value store that saves your data to plain old JSON files.
If you like, you can operate on your entire data with classic UNIX tools.
type User struct {
Name string
}
// Data saved to ~/.ocean/User/
users := ocean.New[User]("User")
// Store key and value in memory and write ~/.ocean/User/1.json
users.Set("1", &User{Name: "User 1"})
In a real project you would usually prefix your user collection with a project or company name, serving as a namespace:
// Data saved to ~/.ocean/google/User/
users := ocean.New("google", "User")
You can add as many hierarchies as you need but I recommend using a simple /namespace/collection/
structure.