Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Preferences ¶
type Preferences interface {
// ReadPropertyString attempts to read the property with the given key
// from the prefs store and then attempts to type assert any non-nil value
// as a string. If the store does not exist, or if the store cannot be parsed,
// or the property does not exist, the empty string is returned.
ReadPropertyString(key string) (string, error)
// ReadPropertyInt attempts to read the property with the given key
// from the prefs store and then attempts to type assert any non-nil value
// as an int. If the store does not exist, or if the store cannot be parsed,
// or the property does not exist, 0 is returned.
ReadPropertyInt(key string) (int, error)
// WriteProperty persists a key-value pair to the prefs store.
// If the store cannot be loaded, the write will fail and an error
// will be logged.
WriteProperty(key string, value interface{}) error
}
type Prefs ¶
type Prefs struct {
// contains filtered or unexported fields
}
func (Prefs) ReadPropertyInt ¶
ReadPropertyInt attempts to read the property with the given key from the prefs store and then attempts to type assert any non-nil value as an int. If the store does not exist, or if the store cannot be parsed, or the property does not exist, 0 is returned.
func (Prefs) ReadPropertyString ¶
ReadPropertyString attempts to read the property with the given key from the prefs store and then attempts to type assert any non-nil value as a string. If the store does not exist, or if the store cannot be parsed, or the property does not exist, the empty string is returned.
func (Prefs) WriteProperty ¶
WriteProperty persists a key-value pair to the prefs store. If the store cannot be loaded, the write will fail and an error will be logged.