From 019a72d1525bcc45edeac5511b3aa91d77597034 Mon Sep 17 00:00:00 2001 From: Virgil Date: Sat, 4 Apr 2026 13:25:19 +0000 Subject: [PATCH] docs(store): clarify AX examples for options Co-Authored-By: Virgil --- compact.go | 2 ++ store.go | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/compact.go b/compact.go index 3c912ad..e53b169 100644 --- a/compact.go +++ b/compact.go @@ -15,6 +15,8 @@ var defaultArchiveOutputDirectory = ".core/archive/" // compressed JSONL file. // // Usage example: `options := store.CompactOptions{Before: time.Now().Add(-90 * 24 * time.Hour), Output: "/tmp/archive", Format: "gzip"}` +// The default output directory is `.core/archive/`; the default format is +// `gzip`, and `zstd` is also supported. type CompactOptions struct { // Usage example: `options := store.CompactOptions{Before: time.Now().Add(-90 * 24 * time.Hour)}` Before time.Time diff --git a/store.go b/store.go index 27b9ae2..ea7d57a 100644 --- a/store.go +++ b/store.go @@ -27,10 +27,11 @@ const ( entryValueColumn = "entry_value" ) -// Usage example: `configuredStore, err := store.NewConfigured(store.StoreConfig{DatabasePath: ":memory:", Journal: store.JournalConfiguration{EndpointURL: "http://127.0.0.1:8086", Organisation: "core", BucketName: "events"}})` +// Usage example: `storeInstance, err := store.New("/tmp/go-store.db", store.WithJournal("http://127.0.0.1:8086", "core", "events"), store.WithPurgeInterval(30*time.Second))` // Prefer `store.NewConfigured(store.StoreConfig{...})` when the configuration -// is already known as a struct literal. Use `StoreOption` only when the values -// need to be assembled incrementally. +// is already known as a struct literal. Use `StoreOption` only when values +// need to be assembled incrementally, such as when a caller receives them from +// different sources. type StoreOption func(*StoreConfig) // Usage example: `config := store.StoreConfig{DatabasePath: ":memory:", PurgeInterval: 30 * time.Second}`