resourceparser

package
v1.35.3 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RunAlways = []paths.Pkg{"*"}

RunAlways is a value for InterestingImports to indicate to always run the parser.

Functions

This section is empty.

Types

type Parser

type Parser struct {
	Name string

	// InterestingImports are the imports paths that the parser is interested in.
	// If a package imports any one of them, the Run method is invoked.
	InterestingImports []paths.Pkg

	// InterestingSubdirs are the subdirectories of a package that a parser is interested in.
	// If a package has any one of these subdirectories, the Run method is invoked.
	// Its purpose is to support our current way of defining databases via a "migrations" dir.
	InterestingSubdirs []string

	Run func(*Pass)
}

type Pass

type Pass struct {
	*parsectx.Context
	SchemaParser *schema.Parser

	Pkg *pkginfo.Package
	// contains filtered or unexported fields
}

func (*Pass) AddAnonymousBind added in v1.19.0

func (p *Pass) AddAnonymousBind(file *pkginfo.File, res resource.Resource)

func (*Pass) AddBind

func (p *Pass) AddBind(file *pkginfo.File, boundName option.Option[*ast.Ident], res resource.Resource)

func (*Pass) AddImplicitBind

func (p *Pass) AddImplicitBind(res resource.Resource)

func (*Pass) AddNamedBind added in v1.19.0

func (p *Pass) AddNamedBind(file *pkginfo.File, boundName *ast.Ident, res resource.Resource)

func (*Pass) AddPathBind

func (p *Pass) AddPathBind(file *pkginfo.File, boundName option.Option[*ast.Ident], path resource.Path)

func (*Pass) Binds

func (p *Pass) Binds() []resource.Bind

func (*Pass) RegisterResource

func (p *Pass) RegisterResource(resource resource.Resource)

func (*Pass) Resources

func (p *Pass) Resources() []resource.Resource

type Registry

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

func NewRegistry

func NewRegistry(parsers []*Parser) *Registry

func (*Registry) InterestedParsers

func (r *Registry) InterestedParsers(pkg *pkginfo.Package) []*Parser

InterestedParsers returns the parsers interested in processing a given package.

Jump to

Keyboard shortcuts

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