yaml

package
v1.18.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanMerge added in v1.9.9

func CleanMerge(yamls [][]byte) ([]byte, error)

func ContainsFlatKey added in v1.9.9

func ContainsFlatKey(source string, excludedKeys []string, keys []string) (bool, error)

func DiffFlatKeys added in v1.9.9

func DiffFlatKeys(source, target string) ([]string, error)

DiffFlatKeys finds flat keys with different values from two yamls

func Equal added in v1.9.9

func Equal(source, target string) (bool, error)

func ExtractVariableYaml added in v1.9.9

func ExtractVariableYaml(sourceTmpl string) (string, error)

ExtractVariableYaml extracts variables from go-template and packages into yaml

func Merge

func Merge(yamls [][]byte) ([]byte, error)

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

func MergeAndUnmarshal(yamls [][]byte) (map[string]interface{}, error)

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 added in v1.9.9

type ComplexStruct map[string]interface{}

ComplexStruct is the alias of map, so operator 'len' is supported in go-template

func (*ComplexStruct) Get added in v1.9.9

func (cs *ComplexStruct) Get(key string) interface{}

func (*ComplexStruct) Insert added in v1.9.9

func (cs *ComplexStruct) Insert(key string, notParent bool)

func (*ComplexStruct) String added in v1.9.9

func (cs *ComplexStruct) String() string

Jump to

Keyboard shortcuts

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