cfg

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigAdd    = ConfigChangeType("add")
	ConfigRemove = ConfigChangeType("remove")
	ConfigChange = ConfigChangeType("change")
)

Variables

View Source
var ArrayBlanks = "- "

ArrayBlanks 数组缩进

View Source
var Dot = "."

Dot 点

View Source
var IndentBlanks = "  "

IndentBlanks 缩进空格

View Source
var NewLine = "\n"

NewLine 换行符

View Source
var SignEqual = "="

SignEqual 等号连接符

View Source
var SignSemicolon = ":"

SignSemicolon 分号连接符

View Source
var YamlNewLineDom = "|\n"

NewLineDom yaml的value换行符

Functions

func GetPropertiesItemLineList

func GetPropertiesItemLineList(content string) []string

func IsJson

func IsJson(content string) bool

func IsProperty

func IsProperty(content string) bool

func IsYaml

func IsYaml(content string) bool

func JsonToFlatMap

func JsonToFlatMap(content string) (map[string]string, error)

func JsonToMap

func JsonToMap(contentOfJson string) (map[string]interface{}, error)

func JsonToYaml

func JsonToYaml(contentOfJson string) (string, error)

func KvToProperties

func KvToProperties(key, value string, valueType TypeEnum) (string, error)

func MapToProperties

func MapToProperties(dataMap map[string]interface{}) (string, error)

MapToProperties 进行深层嵌套的map数据处理

func ObjectToYaml

func ObjectToYaml(value interface{}) (string, error)

func PropertiesEntityToYaml

func PropertiesEntityToYaml(properties Properties) (string, error)

func PropertiesToMap

func PropertiesToMap(contentOfProperties string) (map[string]string, error)

func PropertiesToYaml

func PropertiesToYaml(contentOfProperties string) (string, error)

func RoutConfig

func RoutConfig(party iris.Party)

RoutConfig /api/cfg/

func RouteInner

func RouteInner(app *iris.Application)

func YamlCheck

func YamlCheck(content string) error

func YamlToFlatMap

func YamlToFlatMap(content string) (map[string]string, error)

func YamlToJson

func YamlToJson(contentOfYaml string) (string, error)

func YamlToList

func YamlToList(contentOfYaml string) ([]interface{}, error)

YamlToList 只适合转存粹是list的

func YamlToMap

func YamlToMap(contentOfYaml string) (map[string]interface{}, error)

func YamlToProperties

func YamlToProperties(contentOfYaml string) (string, error)

func YamlToPropertiesWithKey

func YamlToPropertiesWithKey(key string, contentOfYaml string) (string, error)

Types

type ConfigChangeEvent

type ConfigChangeEvent struct {
	Namespace string           `json:"namespace,omitempty"`
	Key       string           `json:"key,omitempty"`
	Type      ConfigChangeType `json:"type,omitempty"`
	Current   string           `json:"current,omitempty"`
	Before    string           `json:"before,omitempty"`
}

type ConfigChangeRequest

type ConfigChangeRequest struct {
	AppId string         `json:"appId,omitempty"`
	Group string         `json:"group,omitempty"`
	Diff  *NamespaceDiff `json:"diff,omitempty"`
}

type ConfigChangeType

type ConfigChangeType string

type ConvertError

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

func (*ConvertError) Error

func (convertError *ConvertError) Error() string

type NamespaceClientRequest

type NamespaceClientRequest struct {
	AppId            string   `json:"appId,omitempty"`
	Group            string   `json:"group,omitempty"`
	Namespaces       []string `json:"namespaces,omitempty"`
	SharedNamespaces []string `json:"sharedNamespaces,omitempty"`
}

func (*NamespaceClientRequest) Keys

func (r *NamespaceClientRequest) Keys() []string

Keys 获取一个应用锁监听的所有Namespace对应的 数据KEY列表

type NamespaceDiff

type NamespaceDiff struct {
	Namespace string                `json:"namespace,omitempty"`
	Same      bool                  `json:"same,omitempty"`
	Added     map[string]string     `json:"added,omitempty"`
	Removed   map[string]string     `json:"removed,omitempty"`
	Changed   map[string]StringPair `json:"changed,omitempty"`
	Unchanged map[string]string     `json:"unchanged,omitempty"`
}

type NamespaceEditHistory

type NamespaceEditHistory struct {
	Time       time.Time `json:"time"`
	ModifiedBy string    `json:"modifiedBy,omitempty"`
	Content    string    `json:"content,omitempty"`
}

type NamespaceHistory

type NamespaceHistory []*NamespaceEditHistory

func (NamespaceHistory) Len

func (n NamespaceHistory) Len() int

func (NamespaceHistory) Less

func (n NamespaceHistory) Less(i, j int) bool

func (NamespaceHistory) Swap

func (n NamespaceHistory) Swap(i, j int)

type NamespaceReq

type NamespaceReq struct {
	AppId     string `json:"appId,omitempty"`
	Group     string `json:"group,omitempty"`
	Namespace string `json:"namespace,omitempty"`
	Content   string `json:"content,omitempty"`
}

func (*NamespaceReq) Valid

func (ns *NamespaceReq) Valid() error

type Properties

type Properties struct {
	Value map[string]string
}

type StringPair

type StringPair struct {
	Left  string
	Right string
}

func JsonToKvList

func JsonToKvList(content string) ([]StringPair, error)

func YamlToKvList

func YamlToKvList(contentOfYaml string) ([]StringPair, error)

type TypeEnum

type TypeEnum int8
const (
	YAML       TypeEnum = 0
	PROPERTIES TypeEnum = 1
	JSON       TypeEnum = 2
	STRING     TypeEnum = 3
)

type YamlNode

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

Jump to

Keyboard shortcuts

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