zconfig

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: MIT Imports: 12 Imported by: 0

README

zconfig Build Status Coverage Status

A parse configure file library for Go.

Features

  • default support parse yaml, json, toml
  • support add other format parser by option

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewErrFileNotFound

func NewErrFileNotFound(file, location string, err error) error

NewErrFileNotFound returns a new ErrFileNotFound

func NewErrInvalidCfgExt

func NewErrInvalidCfgExt(str string) error

NewErrInvalidCfgExt returns a new ErrInvalidCfgExt error of not supported config file type

func NewErrUnsupportedCfgType

func NewErrUnsupportedCfgType(obj interface{}) error

NewErrUnsupportedCfgType returns a new ErrUnsupportedCfgType

func NewErrUnsupportedUnmarshal

func NewErrUnsupportedUnmarshal(str string) error

NewErrUnsupportedUnmarshal returns a new ErrUnsupportedUnmarshal

Types

type Configurator

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

Configurator config manager

func New

func New() *Configurator

New return config manager

func (*Configurator) Initialize

func (c *Configurator) Initialize(configFile string, cfgStructPtr interface{}) error

Initialize your config

func (*Configurator) Reset

func (c *Configurator) Reset() *Configurator

Reset reset config manager

type ErrFileNotFound

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

ErrFileNotFound denotes failing to find configuration file.

func (ErrFileNotFound) Error

func (e ErrFileNotFound) Error() string

Error returns the formatted configuration error.

func (ErrFileNotFound) Unwrap

func (e ErrFileNotFound) Unwrap() error

Unwrap returns the underlying error.

type ErrInvalidCfgExt

type ErrInvalidCfgExt string

ErrInvalidCfgExt denotes an invalid configuration type

func (ErrInvalidCfgExt) Error

func (str ErrInvalidCfgExt) Error() string

Error returns the formatted configuration error.

type ErrUnmarshal

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

ErrUnmarshal denotes failing to unmarshal configuration file.

func NewErrUnmarshal

func NewErrUnmarshal(err error, bs []byte, fType string, fCtr interface{}) *ErrUnmarshal

NewErrUnmarshal returns a new ErrUnmarshal

func (*ErrUnmarshal) Error

func (e *ErrUnmarshal) Error() string

Error returns the formatted ErrUnmarshal.

type ErrUnsupportedCfgType

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

ErrUnsupportedCfgType denotes encountering an unsupported configuration file type.

func (ErrUnsupportedCfgType) Error

func (e ErrUnsupportedCfgType) Error() string

Error returns the formatted configuration error.

type ErrUnsupportedUnmarshal

type ErrUnsupportedUnmarshal string

ErrUnsupportedUnmarshal denotes an unsupported unmarshal type

func (ErrUnsupportedUnmarshal) Error

func (u ErrUnsupportedUnmarshal) Error() string

Error returns the formatted configuration error.

Jump to

Keyboard shortcuts

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