fileloader

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

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

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