parser

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fragment

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

func Parse

func Parse(uri string) ([]Fragment, error)

Parse walks the directories tree and builds the final document.

Example
path := "../testdata/deployment"
res, err := Parse(path)
if err != nil {
	panic(err)
}

fmt.Println(res)
Output:

[{header.yaml false 0 apiVersion: apps/v1
kind: Deployment} {metadata.yaml false 0 metadata:
  name: nginx-deployment
  labels:
    app: nginx} {spec true 0 spec} {spec/replicas.yaml false 1 replicas: 3} {spec/selector.yaml false 1 selector:
  matchLabels:
    app: nginx} {spec/template true 1 template} {spec/template/metadata.yaml false 2 metadata:
  labels:
    app: nginx} {spec/template/spec true 2 spec} {spec/template/spec/containers true 3 containers} {spec/template/spec/containers/nginx.yaml false 4 - name: nginx
  image: nginx:1.21-alpine
  ports:
  - containerPort: 80}]

func (*Fragment) IsKey

func (b *Fragment) IsKey() bool

func (*Fragment) Level

func (b *Fragment) Level() int

func (*Fragment) Path

func (b *Fragment) Path() string

func (*Fragment) String

func (b *Fragment) String() string

Jump to

Keyboard shortcuts

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