settings

package module
v0.0.0-...-17c3a19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2025 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultShallLogUpdates     = true
	DefaultSettingsFilename    = "goapi.settings"
	TheSettings                = New(DefaultSettingsFilename, DefaultShallLogUpdates)
	UpdatePace                 = time.Second
	SettingsKeyValueDelimiters = "=:"
)
View Source
var (
	ErrNoValidDelimiterFound = errors.New("no valid key value delimiter found")
)

Functions

func LineIsAComment

func LineIsAComment(s string) bool

func ParseBool

func ParseBool(s string) (bool, error)

func SplitSettingsLine

func SplitSettingsLine(s string) (key, value string, err error)

Types

type KeyValuePair

type KeyValuePair[K constraints.Ordered, V any] struct {
	Key   K
	Value V
}

type Settings

type Settings struct {
	// contains filtered or unexported fields
}

func New

func New(filename string, shallLogUpdates bool) *Settings

func NewWithContext

func NewWithContext(ctx context.Context, filename string, shallLogUpdates bool) *Settings

func (*Settings) Get

func (s *Settings) Get(key string) string

func (*Settings) GetSlice

func (s *Settings) GetSlice(keys []string) []string

func (*Settings) Set

func (s *Settings) Set(key, value string) bool

func (*Settings) SetFilename

func (s *Settings) SetFilename(filename string) (changed bool)

func (*Settings) SetLogUpdates

func (s *Settings) SetLogUpdates(value bool) (changed bool)

func (*Settings) SetSlice

func (s *Settings) SetSlice(keyValuePairs []KeyValuePair[string, string]) []bool

func (*Settings) Update

func (s *Settings) Update() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL