Documentation ¶
Index ¶
- func CleanMerge(yamls [][]byte) ([]byte, error)
- func ContainsFlatKey(source string, excludedKeys []string, keys []string) (bool, error)
- func DiffFlatKeys(source, target string) ([]string, error)
- func Equal(source, target string) (bool, error)
- func ExtractVariableYaml(sourceTmpl string) (string, error)
- func Merge(yamls [][]byte) ([]byte, error)
- func MergeAndUnmarshal(yamls [][]byte) (map[string]interface{}, error)
- func SearchByPattern(flatMap map[string]interface{}, patterns []map[string]string) ([]map[string]string, error)
- type ComplexStruct
- type PathPattern
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanMerge ¶
func ContainsFlatKey ¶
func DiffFlatKeys ¶
DiffFlatKeys finds flat keys with different values from two yamls
func ExtractVariableYaml ¶
ExtractVariableYaml extracts variables from go-template and packages into yaml
func Merge ¶
Merge merges a couple of yaml files into one yaml file, a field in latter file will override the same field in former file.
func MergeAndUnmarshal ¶
MergeAndUnmarshal merges a couple of yaml files into one yaml file, and return a map[string]interface{}, a field in latter file will override the same field in former file.
func SearchByPattern ¶
func SearchByPattern(flatMap map[string]interface{}, patterns []map[string]string) ([]map[string]string, error)
SearchByPattern find all matched absolute paths from yaml by the pattern appointed input pattern: []map{name => relative-path} output: app paths found which match the relative-path rule, []{map[name]=>absolute-path} eg: sourceYaml: ---------- yaml begin env: dev svc1:
image: repository: go-sample-site tag: "0.2.1"
svc2:
image: repository: go-sample-site-2 tag: "0.2.2"
imagePullSecrets:
- name: default-secret
----------- yaml end pattern: []{"image": "repository", "tag": "tag"} output: []{{"image": "svc1.image.repository", "tag": "svc1.image.tag"}, {"image": "svc2.image.repository", "tag": "svc2.image.tag"}}
Types ¶
type ComplexStruct ¶
type ComplexStruct map[string]interface{}
ComplexStruct is the alias of map, so operator 'len' is supported in go-template
func (*ComplexStruct) Get ¶
func (cs *ComplexStruct) Get(key string) interface{}
func (*ComplexStruct) Insert ¶
func (cs *ComplexStruct) Insert(key string, notParent bool)
func (*ComplexStruct) String ¶
func (cs *ComplexStruct) String() string