common

package
v0.1.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenericCataloger

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

GenericCataloger implements the Catalog interface and is responsible for dispatching the proper parser function for a given path or glob pattern. This is intended to be reusable across many package cataloger types.

func NewGenericCataloger

func NewGenericCataloger(pathParsers map[string]ParserFn, globParsers map[string]ParserFn) GenericCataloger

NewGenericCataloger if provided path-to-parser-function and glob-to-parser-function lookups creates a GenericCataloger

func (*GenericCataloger) Catalog

func (a *GenericCataloger) Catalog(contents map[file.Reference]string, upstreamMatcher string) ([]pkg.Package, error)

Catalog takes a set of file contents and uses any configured parser functions to resolve and return discovered packages

func (*GenericCataloger) SelectFiles

func (a *GenericCataloger) SelectFiles(resolver scope.FileResolver) []file.Reference

SelectFiles takes a set of file trees and resolves and file references of interest for future cataloging

type ParserFn

type ParserFn func(string, io.Reader) ([]pkg.Package, error)

ParserFn standardizes a function signature for parser functions that accept the virtual file path (not usable for file reads) and contents and return any discovered packages from that file

Jump to

Keyboard shortcuts

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