config

package module
v0.0.0-...-3093327 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2022 License: MIT Imports: 6 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

config

The configurator support toml and yaml and json for GoLang

Documentation

Overview

Author: Kernel.Huang Mail: kernelman79@gmail.com File: config.go Date: 8/9/22 1:57 PM

Author: Kernel.Huang Mail: kernelman79@gmail.com File: config.go Date: 8/9/22 1:57 PM

Index

Constants

This section is empty.

Variables

View Source
var Toml = new(TomlConfig)
View Source
var Yaml = new(YamlConfig)

Functions

This section is empty.

Types

type TomlConfig

type TomlConfig struct {
	Structured interface{}
	// contains filtered or unexported fields
}

func (*TomlConfig) AtBool

func (tf *TomlConfig) AtBool() bool

Example: result := Tome.NewToml(dirname, filename).Zone("zoneName").Get("key").AtBool()

func (*TomlConfig) AtInt

func (tf *TomlConfig) AtInt() int

Example: result := Tome.NewToml(dirname, filename).Zone("zoneName").Get("key").AtInt()

func (*TomlConfig) AtInt64

func (tf *TomlConfig) AtInt64() int64

Example: result := Tome.NewToml(dirname, filename).Zone("zoneName").Get("key").AtInt64()

func (*TomlConfig) AtStr

func (tf *TomlConfig) AtStr() string

Example: result := Tome.NewToml(dirname, filename).Zone("zoneName").Get("key").AtStr()

func (*TomlConfig) Fetch

func (tf *TomlConfig) Fetch(key string) *TomlConfig

Example: result := Tome.NewToml(dirname, filename).Zone("zoneName").Fetch("key").ToStr()

func (*TomlConfig) Get

func (tf *TomlConfig) Get(key string) *TomlConfig

Example: result := Tome.NewToml(dirname, filename).Zone("zoneName").Get("key").To()

func (*TomlConfig) Got

func (tf *TomlConfig) Got(key string) *TomlConfig

The Fetch function alias Example: result := Tome.NewToml(dirname, filename).Zone("zoneName").Got("key").ToStr()

func (*TomlConfig) NewStructToml

func (tf *TomlConfig) NewStructToml(dirname string, filename string, structured any) any

Example:

var structured structuredConfig
config.Toml.NewStructToml("config", "config.toml", &structured)

func (*TomlConfig) NewToml

func (tf *TomlConfig) NewToml(dirname string, filename string) *TomlConfig

func (*TomlConfig) Read

func (tf *TomlConfig) Read(key string) *TomlConfig

Example: result := Tome.NewToml(dirname, filename).Read("zoneName.key").ToStr() or ToInt()

func (*TomlConfig) To

func (tf *TomlConfig) To() interface{}

*

  • Example: result := Tome.NewToml(dirname, filename).Zone("zoneName").Get("key").To()

func (*TomlConfig) ToBool

func (tf *TomlConfig) ToBool() bool

Example: result := Tome.NewToml(dirname, filename).Read("zoneName.key").ToBool()

func (*TomlConfig) ToInt

func (tf *TomlConfig) ToInt() int

Example: result := Tome.NewToml(dirname, filename).Read("zoneName.key").ToInt()

func (*TomlConfig) ToInt64

func (tf *TomlConfig) ToInt64() int64

Example: result := Tome.NewToml(dirname, filename).Read("zoneName.key").ToInt64()

func (*TomlConfig) ToStr

func (tf *TomlConfig) ToStr() string

Example: result := Tome.NewToml(dirname, filename).Read("zoneName.key").ToStr()

func (*TomlConfig) Zone

func (tf *TomlConfig) Zone(key string) *TomlConfig

Example: result := Tome.NewToml(dirname, filename).Zone("zoneName").Get("key").To()

type YamlConfig

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

func (*YamlConfig) NewYaml

func (yc *YamlConfig) NewYaml(dirname string, filename string) *YamlConfig

func (*YamlConfig) Parse

func (yc *YamlConfig) Parse(structured any) any

Example:

var structured structuredConfig
config.Yaml.NewYaml("config", "config.toml").Parse(&structured)

Jump to

Keyboard shortcuts

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