docs(store): add field usage examples
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
a82b0d379b
commit
a458464876
2 changed files with 13 additions and 5 deletions
13
events.go
13
events.go
|
|
@ -36,10 +36,15 @@ func (t EventType) String() string {
|
|||
// Usage example: `event := store.Event{Type: store.EventSet, Group: "config", Key: "theme", Value: "dark"}`
|
||||
// Usage example: `event := store.Event{Type: store.EventDeleteGroup, Group: "config"}`
|
||||
type Event struct {
|
||||
Type EventType
|
||||
Group string
|
||||
Key string
|
||||
Value string
|
||||
// Usage example: `if event.Type == store.EventDeleteGroup { return }`
|
||||
Type EventType
|
||||
// Usage example: `if event.Group == "config" { return }`
|
||||
Group string
|
||||
// Usage example: `if event.Key == "theme" { return }`
|
||||
Key string
|
||||
// Usage example: `if event.Value == "dark" { return }`
|
||||
Value string
|
||||
// Usage example: `if event.Timestamp.IsZero() { return }`
|
||||
Timestamp time.Time
|
||||
}
|
||||
|
||||
|
|
|
|||
5
store.go
5
store.go
|
|
@ -169,7 +169,10 @@ func (storeInstance *Store) DeleteGroup(group string) error {
|
|||
|
||||
// Usage example: `for entry, err := range storeInstance.All("config") { if err != nil { break }; core.Println(entry.Key, entry.Value) }`
|
||||
type KeyValue struct {
|
||||
Key, Value string
|
||||
// Usage example: `if entry.Key == "theme" { return }`
|
||||
Key string
|
||||
// Usage example: `if entry.Value == "dark" { return }`
|
||||
Value string
|
||||
}
|
||||
|
||||
// Usage example: `configEntries, err := storeInstance.GetAll("config")`
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue