parser

package
v0.3.27 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnnotatedReadCloser added in v0.3.20

type AnnotatedReadCloser interface {
	io.ReadCloser
	Annotate() interface{}
}

AnnotatedReadCloser is a wrapper around io.ReadCloser that allows implementations to supply additional information about data that is read.

type Backend added in v0.3.20

type Backend interface {
	Init(context.Context, ...BackendOption) (io.ReadCloser, error)
}

Backend provides a source for a parser.

type BackendOption added in v0.3.20

type BackendOption func(Backend)

BackendOption modifies the parser backend. Backends may accept options at creation time, but must accept them at initialization.

type Linter added in v0.3.21

type Linter interface {
	Lint(*Package) error
}

A Linter lints packages.

type ObjectCreaterTyper

type ObjectCreaterTyper interface {
	runtime.ObjectCreater
	runtime.ObjectTyper
}

ObjectCreaterTyper know how to create and determine the type of objects.

type ObjectLinterFn

type ObjectLinterFn func(runtime.Object) error

ObjectLinterFn lints an object in a package.

func ObjectLinterFns added in v0.3.21

func ObjectLinterFns(fns ...ObjectLinterFn) []ObjectLinterFn

ObjectLinterFns is a convenience function to pass multiple ObjectLinterFn to a function that cannot accept variadic arguments.

func Or added in v0.3.23

Or checks that at least one of the passed linter functions does not return an error.

type Package

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

Package is the set of metadata and objects in a package.

func NewPackage added in v0.3.20

func NewPackage() *Package

NewPackage creates a new Package.

func (*Package) GetMeta added in v0.3.20

func (p *Package) GetMeta() []runtime.Object

GetMeta gets metadata from the package.

func (*Package) GetObjects added in v0.3.20

func (p *Package) GetObjects() []runtime.Object

GetObjects gets objects from the package.

type PackageLinter

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

PackageLinter lints packages by applying package and object linter functions to it.

func NewPackageLinter

func NewPackageLinter(pre []PackageLinterFn, perMeta, perObject []ObjectLinterFn) *PackageLinter

NewPackageLinter creates a new PackageLinter.

func (*PackageLinter) Lint added in v0.3.22

func (l *PackageLinter) Lint(pkg *Package) error

Lint executes all linter functions against a package.

type PackageLinterFn

type PackageLinterFn func(*Package) error

PackageLinterFn lints an entire package. If function applies a check for multiple objects, consider using an ObjectLinterFn.

func PackageLinterFns added in v0.3.21

func PackageLinterFns(fns ...PackageLinterFn) []PackageLinterFn

PackageLinterFns is a convenience function to pass multiple PackageLinterFn to a function that cannot accept variadic arguments.

type PackageParser

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

PackageParser is a Parser implementation for parsing packages.

func New

func New(meta, obj ObjectCreaterTyper) *PackageParser

New returns a new PackageParser.

func (*PackageParser) Parse added in v0.3.20

func (p *PackageParser) Parse(ctx context.Context, reader io.ReadCloser) (*Package, error)

Parse is the underlying logic for parsing packages. It first attempts to decode objects recognized by the meta scheme, then attempts to decode objects recognized by the object scheme. Objects not recognized by either scheme return an error rather than being skipped.

type Parser added in v0.3.20

type Parser interface {
	Parse(context.Context, io.ReadCloser) (*Package, error)
}

Parser is a package parser.

Jump to

Keyboard shortcuts

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