diff --git a/doc.go b/doc.go index b2d7cde..90d17e1 100644 --- a/doc.go +++ b/doc.go @@ -5,12 +5,6 @@ // Usage example: // // func main() { -// storeInstance, err := store.New(":memory:") -// if err != nil { -// return -// } -// defer storeInstance.Close() -// // configuredStore, err := store.NewConfigured(store.StoreConfig{ // DatabasePath: ":memory:", // Journal: store.JournalConfiguration{ @@ -25,6 +19,12 @@ // } // defer configuredStore.Close() // +// storeInstance, err := store.New(":memory:") +// if err != nil { +// return +// } +// defer storeInstance.Close() +// // if err := storeInstance.Set("config", "colour", "blue"); err != nil { // return // } diff --git a/docs/index.md b/docs/index.md index c05b5c5..a5d8495 100644 --- a/docs/index.md +++ b/docs/index.md @@ -7,7 +7,7 @@ description: Group-namespaced SQLite key-value store with TTL expiry, namespace `go-store` is a group-namespaced key-value store backed by SQLite. It provides persistent or in-memory storage with optional TTL expiry, namespace isolation for multi-tenant use, quota enforcement, and a reactive event system for observing mutations. -For declarative setup, `store.NewConfigured(store.StoreConfig{...})` takes a single config struct instead of functional options. +For declarative setup, `store.NewConfigured(store.StoreConfig{...})` takes a single config struct instead of functional options. Prefer this when the configuration is already known; use `store.New(path, ...)` when you are only varying the database path. The package has a single runtime dependency -- a pure-Go SQLite driver (`modernc.org/sqlite`). No CGO is required. It compiles and runs on all platforms that Go supports. @@ -29,7 +29,10 @@ import ( func main() { // Open /tmp/app.db for persistence, or use ":memory:" for ephemeral data. - storeInstance, err := store.New("/tmp/app.db") + storeInstance, err := store.NewConfigured(store.StoreConfig{ + DatabasePath: "/tmp/app.db", + PurgeInterval: 30 * time.Second, + }) if err != nil { return }