fileloader

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedFileFormat = errors.New("unsupported file format")
View Source
var LoaderName = "file"

Functions

func Decoders

func Decoders() map[string]Decoder

Types

type Decoder

type Decoder interface {
	Decode(r io.Reader, to interface{}) error
}

type Loader

type Loader struct {
	FileSuffix []string
	Folders    []string
	Decoders   map[string]Decoder
	MapDecoder func(data any, to any) error
}

func New

func New() *Loader

func (Loader) LoadChu

func (l Loader) LoadChu(ctx context.Context, to any, opts ...loader.Option) error

Load loads the configuration from the file.

  • first it checks the current directory after that it checks the etc folder.
  • CONFIG_PATH environment variable is used to determine the file path.

Jump to

Keyboard shortcuts

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