goconfig

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

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

README

config

一键配置导入库,具备监控热更新功能

Documentation

Index

Constants

View Source
const (
	Local = "local"
	Dev   = "dev"
	Test  = "test"
	Prod  = "prod"
)

run env

View Source
const (
	Yaml = "yaml"
	Json = "json"
	Xml  = "xml"
)

file type

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

func Load

func Load(file string, options ...Option) *Config

func (*Config) Env

func (c *Config) Env() string

func (*Config) Scan

func (c *Config) Scan(v any) error

type Option

type Option func(c *Config)

func Environment

func Environment(isReadFromEnv bool, env string) Option

if (isReadFromEnv==true) { config.{env}.yaml } else { config.env.yaml}

func SearchPath

func SearchPath(path string) Option

Default current program directory

func WatchFileChange

func WatchFileChange(f func(config any, err error)) Option

Jump to

Keyboard shortcuts

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