From d1b773542b94f81ac4fea8773aefbd8d77d71482 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Thu, 6 Jul 2023 14:41:36 +0200 Subject: [PATCH] Improved documentation --- README.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2f4f67b..199989c 100644 --- a/README.md +++ b/README.md @@ -4,17 +4,20 @@ 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. -Let's say we use this struct to save our user data: +## Installation ```go +go get git.akyoto.dev/go/ocean +``` + +## Examples + +```go +// User data type User struct { Name string } -``` -Then we can create a typesafe collection using Go generics: - -```go // Data saved to ~/.ocean/User/ users := ocean.New[User]("User") @@ -29,4 +32,10 @@ In a real project you would usually prefix your collections with a project or co users := ocean.New[User]("google", "User") ``` -You can add as many hierarchies as you need but I recommend using a simple `/namespace/collection/` structure. +## Recommended structure + +You can add as many directory hierarchies as you need but I recommend using a simple `/namespace/collection/` structure. + +Collections should use the singular instead of the plural form (`User` instead of `Users`) because it's better for automation. + +Ocean does not enforce these standards but they are heavily recommended.