gobstore/example_test.go

23 lines
395 B
Go
Raw Permalink Normal View History

2025-01-12 09:51:51 +00:00
package gobstore_test
import (
"fmt"
"git.bivouac.wiki/use/gobstore"
)
func ExampleStore() {
type FooBar struct{ Greeting string }
A := gobstore.NewStore[FooBar]("./", "file.gob")
A.Load()
A.Hidden_save()
//go A.WatchFlush()
A.Set("foobar", FooBar{Greeting: "Hello"})
resp, ok := A.Get("foobar")
if !ok {
fmt.Println("missing!")
}
fmt.Println(resp.Greeting)
// Output: Hello
}