Documentation
¶
Overview ¶
Package syncmap contains an implementation of the `gokv.Store` interface for a Go `sync.Map`.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultOptions = Options{}
DefaultOptions is an Options object with default values. MarshalFormat: JSON
Functions ¶
This section is empty.
Types ¶
type MarshalFormat ¶ added in v0.3.0
type MarshalFormat int
MarshalFormat is an enum for the available (un-)marshal formats of this gokv.Store implementation.
const ( // JSON is the MarshalFormat for (un-)marshalling to/from JSON JSON MarshalFormat = iota // Gob is the MarshalFormat for (un-)marshalling to/from gob Gob )
type Options ¶ added in v0.3.0
type Options struct { // (Un-)marshal format. // Optional (JSON by default). MarshalFormat MarshalFormat }
Options are the options for the Go sync.Map store.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a gokv.Store implementation for a Go sync.Map.
func (Store) Close ¶ added in v0.4.0
Close closes the store. When called, the store's pointer to the internal Go map is set to nil, leading to the map being free for garbage collection.
func (Store) Delete ¶ added in v0.3.0
Delete deletes the stored value for the given key. Deleting a non-existing key-value pair does NOT lead to an error. The key must not be "".
func (Store) Get ¶
Get retrieves the stored value for the given key. You need to pass a pointer to the value, so in case of a struct the automatic unmarshalling can populate the fields of the object that v points to with the values of the retrieved object's values. If no value is found it returns (false, nil). The key must not be "" and the pointer must not be nil.