Documentation
¶
Index ¶
- Variables
- type ChangeEvent
- type EventHook
- type FlagDoesNotExistError
- type FlagNotFoundError
- type Format
- type FormatNotSupportedError
- type MismatchedTypeError
- type PathAlreadyExistsError
- type PathDoesNotExistError
- type Settings
- func (s *Settings[C]) AddDirectory(d string) *Settings[C]
- func (s *Settings[C]) AddEtcDirectory() *Settings[C]
- func (s *Settings[C]) AddFile(file string, format Format) *Settings[C]
- func (s *Settings[C]) AddFileFromFlagSet(flagset *flag.FlagSet, name string, format Format) *Settings[C]
- func (s *Settings[C]) AddReader(r io.Reader, format Format) *Settings[C]
- func (s *Settings[C]) AddUserConfigDirectory() *Settings[C]
- func (s *Settings[C]) AddWorkingDirectory() *Settings[C]
- func (s *Settings[C]) Config() C
- func (s *Settings[C]) Directories() []string
- func (s *Settings[C]) Errors() []error
- func (s *Settings[C]) Export() *Settings[C]
- func (s *Settings[C]) HasErrors() bool
- func (s *Settings[C]) Import() *Settings[C]
- func (s *Settings[C]) InitFromEnv(prefix string) *Settings[C]
- func (s *Settings[C]) InitFromFlagSet(flagset *flag.FlagSet) *Settings[C]
- func (s *Settings[C]) Middleware(next http.Handler) http.Handler
- func (s *Settings[C]) OnChange(hook EventHook) *Settings[C]
- func (s *Settings[C]) ResetErrors() *Settings[C]
- func (s *Settings[C]) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Settings[C]) SetConfig(config C) *Settings[C]
- func (s *Settings[C]) SetDefaultDirectories() *Settings[C]
- func (s *Settings[C]) SetDirectories(d []string) *Settings[C]
- func (s *Settings[C]) SetFileFormat(format Format) *Settings[C]
- func (s *Settings[C]) SetFileName(name string) *Settings[C]
- func (s *Settings[C]) SetFilesystem(f fs.FS) *Settings[C]
- func (s *Settings[C]) SetMnemonic(mnemonic string) *Settings[C]
- func (s *Settings[C]) StopWatching() *Settings[C]
- func (s *Settings[C]) Watch() *Settings[C]
- func (s *Settings[C]) Write(writer io.Writer, format Format) *Settings[C]
- func (s *Settings[C]) WriteFile(fn string, format Format) *Settings[C]
- type UnsupportedReflectKindError
- type UnsupportedTypeError
Constants ¶
This section is empty.
Variables ¶
var FileNameEmptyError = errors.New("file name is empty")
var MnemonicEmptyError = errors.New("mnemonic is empty")
var NoFileImportedError = errors.New("no file imported")
var NoFilesToWatchError = errors.New("no files to watch")
var WatchAlreadyInitializedError = errors.New("watch already initialized")
var WatchAlreadyRunningError = errors.New("watch already running")
var WatchListNotInitializedError = errors.New("watch list not initialized")
var WatchNotInitializedError = errors.New("watch not initialized")
var WatchNotRunningError = errors.New("watch not running")
Functions ¶
This section is empty.
Types ¶
type ChangeEvent ¶
type ChangeEvent struct {
Changlog diff.Changelog
}
type EventHook ¶
type EventHook func(event ChangeEvent)
type FlagDoesNotExistError ¶
type FlagDoesNotExistError error
type FlagNotFoundError ¶
type FlagNotFoundError error
This error indicates that the flag is not found
type FormatNotSupportedError ¶
type FormatNotSupportedError error
FormatNotSupportedError is returned when the format is not supported
type MismatchedTypeError ¶
type MismatchedTypeError error
MismatchedTypeError is used to indicate that the type is not matching
type PathAlreadyExistsError ¶
type PathAlreadyExistsError error
PathAlreadyExistsError is returned when a files already exists
type PathDoesNotExistError ¶
type PathDoesNotExistError error
PathDoesNotExistError is returned when a files do not exist
type Settings ¶
func (*Settings[C]) AddDirectory ¶
AddPath adds a directory to the configuration directory
func (*Settings[C]) AddEtcDirectory ¶
Add the Unix etc directory to the configuration directory
func (*Settings[C]) AddFileFromFlagSet ¶
func (s *Settings[C]) AddFileFromFlagSet(flagset *flag.FlagSet, name string, format Format) *Settings[C]
AddFileFromFlagSet adds a file to the configuration The file is read from the flag specified by the name
func (*Settings[C]) AddUserConfigDirectory ¶
Add the user configuration directory to the configuration directory The mnemonic must be set for this function
func (*Settings[C]) AddWorkingDirectory ¶
Add the current working directory to the configuration directory
func (*Settings[C]) Directories ¶
Path returns the configuration directory
func (*Settings[C]) InitFromEnv ¶
func (*Settings[C]) InitFromFlagSet ¶
InitFromFlagSet initializes the configuration from the command line flags.
func (*Settings[C]) Middleware ¶
ContextKey is the key used to store the configuration in the request context This is used by the middleware
func (*Settings[C]) ResetErrors ¶
ResetError is used to reset the error to nil After calling this function, the call HasErrors() will return false
func (*Settings[C]) ServeHTTP ¶
func (s *Settings[C]) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler interface
func (*Settings[C]) SetDefaultDirectories ¶
Add the current working directory, the user configuration directory and the Unix etc directory to the configuration directory
func (*Settings[C]) SetDirectories ¶
Set all configuration directories
func (*Settings[C]) SetFileFormat ¶
func (*Settings[C]) SetFileName ¶
Set the file name without extension
func (*Settings[C]) SetMnemonic ¶
Set the mnemonic The mnemonic is used to identify the configuration in the configuration file
func (*Settings[C]) StopWatching ¶
type UnsupportedReflectKindError ¶
type UnsupportedReflectKindError error
At the reflect level, some types are not supported
type UnsupportedTypeError ¶
type UnsupportedTypeError error
UnsupportedTypeError is returned when the type is not supported