conf

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 12 Imported by: 3

Documentation

Overview

Package conf provides .conf file loading and unmarshalling

Package conf provides .conf file loading and unmarshalling

Package conf provides .conf file loading and unmarshalling

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCurrentConfigPath

func GetCurrentConfigPath() string

GetCurrentConfigPath returns a path of the current config file.

func Load

func Load(filename string, v interface{}) (err error)

func LoadUserParams

func LoadUserParams(v interface{}) (err error)

func Unmarshal

func Unmarshal(data interface{}, v interface{}, args ...interface{}) (err error)

Unmarshal unmarshals input data into specified structure. The input data can be either a byte array ([]byte) with configuration file or interface{} either returned by Marshal or a configuration file Unmarshaled into interface{} variable before. The third is optional 'strict' parameter that forces strict validation of configuration and structure fields (enabled by default). When disabled it will unmarshal part of configuration into incomplete target structures.

Types

type Meta

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

Meta structure is used to store the 'conf' tag metadata.

type Node

type Node struct {
	Name  string
	Nodes []interface{}
	Line  int
	// contains filtered or unexported fields
}

Node structure is used to store parsed conf file parameters or parameter components.

type Session

type Session struct {
	URI      string `conf:"name=Uri,optional"`
	Password string `conf:"optional"`
	User     string `conf:"optional"`
}

Session is a general structure for storing sessions' configuration.

type Suffix

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

type Value

type Value struct {
	Value []byte
	Line  int
}

Jump to

Keyboard shortcuts

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