diff --git a/scope.go b/scope.go index 659aa5a..8e4c68e 100644 --- a/scope.go +++ b/scope.go @@ -37,10 +37,8 @@ type ScopedStore struct { scopedWatchers map[uintptr]*scopedWatcherBinding } -// ScopedStoreTransaction stages multiple namespace-prefixed writes in one -// SQLite transaction and only emits events after commit succeeds. -// // Usage example: `err := scopedStore.Transaction(func(transaction *store.ScopedStoreTransaction) error { return transaction.Set("colour", "blue") })` +// Usage example: `if err := transaction.Delete("config", "colour"); err != nil { return err }` type ScopedStoreTransaction struct { scopedStore *ScopedStore storeTransaction *StoreTransaction diff --git a/store.go b/store.go index d35e668..3c8fcc6 100644 --- a/store.go +++ b/store.go @@ -67,7 +67,7 @@ func (storeConfig StoreConfig) Validate() error { } // Usage example: `config := storeInstance.JournalConfiguration(); fmt.Println(config.EndpointURL, config.Organisation, config.BucketName)` -// The values are copied into the store and used as journal metadata. +// Usage example: `store.New(":memory:", store.WithJournal("http://127.0.0.1:8086", "core", "events"))` type JournalConfiguration struct { // Usage example: `config := store.JournalConfiguration{EndpointURL: "http://127.0.0.1:8086"}` EndpointURL string @@ -84,8 +84,7 @@ func (journalConfig JournalConfiguration) isConfigured() bool { } // 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: `value, err := storeInstance.Get("config", "colour")` type Store struct { sqliteDatabase *sql.DB databasePath string diff --git a/transaction.go b/transaction.go index 60a1711..87de767 100644 --- a/transaction.go +++ b/transaction.go @@ -9,10 +9,8 @@ import ( core "dappco.re/go/core" ) -// StoreTransaction stages several Store operations in one SQLite transaction -// and delays watcher delivery until the commit is durable. -// // Usage example: `err := storeInstance.Transaction(func(transaction *store.StoreTransaction) error { return transaction.Set("config", "colour", "blue") })` +// Usage example: `if err := transaction.Delete("config", "colour"); err != nil { return err }` type StoreTransaction struct { store *Store transaction *sql.Tx