From c6c359e1c7189986e1f5e0bc80040bc3817480b6 Mon Sep 17 00:00:00 2001 From: Virgil Date: Sat, 4 Apr 2026 11:33:32 +0000 Subject: [PATCH] docs(store): add ax-oriented usage examples Co-Authored-By: Virgil --- scope.go | 3 +-- store.go | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/scope.go b/scope.go index 708589b..b5bbf4e 100644 --- a/scope.go +++ b/scope.go @@ -22,10 +22,9 @@ type QuotaConfig struct { MaxGroups int } +// Usage example: `scopedStore := store.NewScoped(storeInstance, "tenant-a"); if scopedStore == nil { return }; if err := scopedStore.Set("colour", "blue"); err != nil { return }; if err := scopedStore.SetIn("config", "language", "en-GB"); err != nil { return }` // ScopedStore keeps one namespace isolated behind helpers such as Set and // GetFrom so callers do not repeat the `tenant-a:` prefix manually. -// -// Usage example: `scopedStore := store.NewScoped(storeInstance, "tenant-a"); if scopedStore == nil { return }; if err := scopedStore.Set("colour", "blue"); err != nil { return }; if err := scopedStore.SetIn("config", "language", "en-GB"); err != nil { return }` type ScopedStore struct { backingStore *Store namespace string diff --git a/store.go b/store.go index ce094e7..5bdb5f4 100644 --- a/store.go +++ b/store.go @@ -94,10 +94,9 @@ func (journalConfig journalConfiguration) isConfigured() bool { journalConfig.bucketName != "" } +// Usage example: `storeInstance, err := store.NewConfigured(store.StoreConfig{DatabasePath: ":memory:", Journal: store.JournalConfiguration{EndpointURL: "http://127.0.0.1:8086", Organisation: "core", BucketName: "events"}, PurgeInterval: 30 * time.Second})` // Store keeps grouped key-value entries in SQLite and can also write completed // work summaries to the journal table. -// -// Usage example: `storeInstance, err := store.NewConfigured(store.StoreConfig{DatabasePath: ":memory:", Journal: store.JournalConfiguration{EndpointURL: "http://127.0.0.1:8086", Organisation: "core", BucketName: "events"}, PurgeInterval: 30 * time.Second})` type Store struct { sqliteDatabase *sql.DB databasePath string