Documentation
¶
Index ¶
- Variables
- func SetFor[T any](p *Preferences, key string, v T)
- type Field
- type Preferences
- func (p *Preferences) Bool(key string) bool
- func (p *Preferences) BoolList(key string) []bool
- func (p *Preferences) Check(key string) bool
- func (p Preferences) ConfigFile() string
- func (p *Preferences) CreateNewFields(overwrite bool, fields ...Field)
- func (p *Preferences) Error() error
- func (p *Preferences) Float(key string) float64
- func (p *Preferences) FloatList(key string) []float64
- func (p Preferences) ID() string
- func (p *Preferences) Int(key string) int
- func (p *Preferences) IntList(key string) []int
- func (p *Preferences) Load(key string) any
- func (p *Preferences) Refresh() error
- func (p *Preferences) RemoveValue(key string)
- func (p *Preferences) Save() error
- func (p *Preferences) Set(key string, value any)
- func (p *Preferences) SetBool(key string, value bool)
- func (p *Preferences) SetBoolList(key string, value []bool)
- func (p *Preferences) SetFloat(key string, value float64)
- func (p *Preferences) SetFloatList(key string, value []float64)
- func (p *Preferences) SetInt(key string, value int)
- func (p *Preferences) SetIntList(key string, value []int)
- func (p *Preferences) SetString(key string, value string)
- func (p *Preferences) SetStringList(key string, value []string)
- func (p *Preferences) SetValue(key string, value reflect.Value)
- func (p *Preferences) String(key string) string
- func (p *Preferences) StringList(key string) []string
- func (p Preferences) Values() map[string]any
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func SetFor ¶ added in v1.6.0
func SetFor[T any](p *Preferences, key string, v T)
Types ¶
type Preferences ¶
type Preferences struct { // If true, the file will be written every time a Set operation is executed. Autosave bool // contains filtered or unexported fields }
func New ¶
func New(id string) (p *Preferences, err error)
func (*Preferences) Bool ¶
func (p *Preferences) Bool(key string) bool
func (*Preferences) BoolList ¶
func (p *Preferences) BoolList(key string) []bool
func (*Preferences) Check ¶ added in v1.4.0
func (p *Preferences) Check(key string) bool
func (Preferences) ConfigFile ¶ added in v1.4.0
func (p Preferences) ConfigFile() string
func (*Preferences) CreateNewFields ¶ added in v1.5.0
func (p *Preferences) CreateNewFields(overwrite bool, fields ...Field)
func (*Preferences) Error ¶ added in v1.5.0
func (p *Preferences) Error() error
Returns possible errors made when autosaving.
func (*Preferences) Float ¶
func (p *Preferences) Float(key string) float64
func (*Preferences) FloatList ¶
func (p *Preferences) FloatList(key string) []float64
func (Preferences) ID ¶ added in v1.6.0
func (p Preferences) ID() string
func (*Preferences) Int ¶
func (p *Preferences) Int(key string) int
func (*Preferences) IntList ¶
func (p *Preferences) IntList(key string) []int
func (*Preferences) Load ¶ added in v1.7.2
func (p *Preferences) Load(key string) any
func (*Preferences) Refresh ¶ added in v1.5.0
func (p *Preferences) Refresh() error
func (*Preferences) RemoveValue ¶
func (p *Preferences) RemoveValue(key string)
func (*Preferences) Save ¶ added in v1.4.0
func (p *Preferences) Save() error
func (*Preferences) Set ¶
func (p *Preferences) Set(key string, value any)
func (*Preferences) SetBool ¶
func (p *Preferences) SetBool(key string, value bool)
func (*Preferences) SetBoolList ¶
func (p *Preferences) SetBoolList(key string, value []bool)
func (*Preferences) SetFloat ¶
func (p *Preferences) SetFloat(key string, value float64)
func (*Preferences) SetFloatList ¶
func (p *Preferences) SetFloatList(key string, value []float64)
func (*Preferences) SetInt ¶
func (p *Preferences) SetInt(key string, value int)
func (*Preferences) SetIntList ¶
func (p *Preferences) SetIntList(key string, value []int)
func (*Preferences) SetString ¶
func (p *Preferences) SetString(key string, value string)
func (*Preferences) SetStringList ¶
func (p *Preferences) SetStringList(key string, value []string)
func (*Preferences) SetValue ¶ added in v1.4.0
func (p *Preferences) SetValue(key string, value reflect.Value)
func (*Preferences) String ¶
func (p *Preferences) String(key string) string
func (*Preferences) StringList ¶
func (p *Preferences) StringList(key string) []string
func (Preferences) Values ¶ added in v1.4.0
func (p Preferences) Values() map[string]any
Click to show internal directories.
Click to hide internal directories.