yamlx

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

*

  • @copyright 像衍科技-idr.ai
  • @author 牛牛-研发部-www.ruomm.com
  • @create 2024/1/23 21:06
  • @version 1.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseYamlFile

func ParseYamlFile(filePath string, obj interface{}) error

* 解析yaml配置文件为对象 * 只能读取指定的配置文件,不会激活环境配置文件

func ParseYamlFileByEnv

func ParseYamlFileByEnv(filePath string, envKey string, envValue string, obj interface{}, options ...YamlxOption) error

* 解析yaml配置文件为对象 * filePath:配置文件路径 * envKey:配置文件中的环境配置key * envValue:指定特定的环境配置值,不为空时候envKey失效 * obj:解析后的配置对象 * # envKey和envValue用来指定环境配置值。 * # envValue有值激活envValue值的环境配置值,没有值则依据{envKey}去指定的配置文件中查找环境配置值。 * # 环境配置值存在时候,会额外加载环境配置文件。环境配置名称为指定的配置文件名称拼接上"-环境配置值"。 * # 如配置文件为:config/conf.yaml,环境配置值为:dev",则激活的配置文件为:config/conf-dev.yaml。 * # 如是指定了环境配置值,激活的配置文件必须存在且可以解析,否则程序异常报错。

func ParseYamlFileByFlag

func ParseYamlFileByFlag(obj interface{}, options ...YamlxOption) (string, error)

* 解析yaml配置文件为对象 * 依据envKey激活环境配置文件,读取环境配置文件和指定的yaml配置文件,环境配置文件的值会覆盖指定的yaml配置文件的值。

func ParseYamlFileByFlagLite added in v0.1.8

func ParseYamlFileByFlagLite(obj interface{}, options ...YamlxOption) (string, error)

* 解析yaml配置文件为对象 * 依据envKey激活环境配置文件,读取环境配置文件和指定的yaml配置文件,环境配置文件的值会覆盖指定的yaml配置文件的值。

func ParseYamlFileByFlagWithPath added in v0.3.2

func ParseYamlFileByFlagWithPath(filePath string, obj interface{}, options ...YamlxOption) (string, error)

* 解析yaml配置文件为对象 * 依据envKey激活环境配置文件,读取环境配置文件和指定的yaml配置文件,环境配置文件的值会覆盖指定的yaml配置文件的值。

func ParseYamlFileToMap

func ParseYamlFileToMap(filePath string) (*map[string]interface{}, error)

* 解析yaml配置文件为map * 只能读取指定的配置文件,不会激活环境配置文件

func ParseYamlFileToMapByEnv

func ParseYamlFileToMapByEnv(filePath string, envKey string, envValue string, options ...YamlxOption) (*map[string]interface{}, string, error)

* 解析yaml配置文件为map * 依据envKey激活环境配置文件,读取环境配置文件和指定的yaml配置文件,环境配置文件的值会覆盖指定的yaml配置文件的值。

Types

type CommondConfigs

type CommondConfigs struct {
	ConfYaml       *string
	WebBindPort    *int
	ProfileActive  *string
	WebContextPath *string
	AuthGlobalTag  *string
}

type StoreSize added in v0.1.1

type StoreSize int64

func (*StoreSize) UnmarshalYAML added in v0.1.1

func (e *StoreSize) UnmarshalYAML(unmarshal func(interface{}) error) error

type TimeMilliSeconds added in v0.1.1

type TimeMilliSeconds int64

func (*TimeMilliSeconds) UnmarshalYAML added in v0.1.1

func (e *TimeMilliSeconds) UnmarshalYAML(unmarshal func(interface{}) error) error

type TimeSeconds added in v0.1.1

type TimeSeconds int64

func (*TimeSeconds) UnmarshalYAML added in v0.1.1

func (e *TimeSeconds) UnmarshalYAML(unmarshal func(interface{}) error) error

type YamlxOption added in v0.1.8

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

属性空值设置 for refx.

func YamlxEnvFileCanEmpty added in v0.1.8

func YamlxEnvFileCanEmpty(canEmpty bool) YamlxOption

设置关联tag的名称,不设置默认为xref

Jump to

Keyboard shortcuts

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