Merge pull request '[agent/codex:gpt-5.4-mini] Read ~/spec/code/core/go/store/RFC.md fully. Find features d...' (#71) from agent/read---spec-code-core-go-store-rfc-md-fu into dev
This commit is contained in:
commit
6bd2197dfe
2 changed files with 11 additions and 8 deletions
12
doc.go
12
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
|
||||
// }
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue