cfg

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

* @Descripttion:配置相关基础函数 * @version: * @Author: lfzxs@qq.com * @Date: 2022-11-22 15:15:46 * @LastEditors: lfzxs@qq.com * @LastEditTime: 2022-11-25 15:24:30

* @Descripttion: nacos 配置 * 参考: https://gitee.com/chenfyu/beego/blob/develop/core/config/yaml/yaml.go * https://goframe.org/pages/viewpage.action?pageId=59864389 * @version: * @Author: lfzxs@qq.com * @Date: 2022-11-18 14:17:50 * @LastEditors: lfzxs@qq.com * @LastEditTime: 2022-11-25 15:47:09

* @Descripttion: YML解析 * @version: * @Author: lfzxs@qq.com * @Date: 2022-11-22 15:43:04 * @LastEditors: lfzxs@qq.com * @LastEditTime: 2023-03-24 15:50:08

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNacosCfg

func CreateNacosCfg(cfg *nacosCfg) (err error)

func ExpandExpEnv

func ExpandExpEnv(env map[string]interface{}, exp string) (realValue string)

解析规则表达式

func ExpandValueAnalysis

func ExpandValueAnalysis(env map[string]interface{}, value string) (realValue string)

func ParseYML

func ParseYML(buf []byte) (data map[string]interface{}, err error)

func ReplaceExp

func ReplaceExp(env map[string]interface{}, content yaml.MapSlice) map[string]interface{}

Types

type YmlCfg

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

func (*YmlCfg) Available

func (self *YmlCfg) Available(ctx context.Context, resource ...string) (ok bool)

func (*YmlCfg) Data

func (self *YmlCfg) Data(ctx context.Context) (data map[string]interface{}, err error)

func (*YmlCfg) Get

func (self *YmlCfg) Get(ctx context.Context, pattern string) (value interface{}, err error)

func (*YmlCfg) GetValue

func (self *YmlCfg) GetValue(name string) interface{}

func (*YmlCfg) LoadData

func (self *YmlCfg) LoadData(data []byte) (err error)

加载

func (*YmlCfg) LoadFromFile

func (self *YmlCfg) LoadFromFile(filePath string) (err error)

加载指定文件

func (*YmlCfg) LoadFromFolders

func (self *YmlCfg) LoadFromFolders(fileName string, searchFolds ...string) (err error)

从多个目录加载

Jump to

Keyboard shortcuts

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