queries

package
v0.14.2-0...-12ef1ef Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package queries provides specific incremental.Query types for various parts of Protocompile. It is separate from package incremental itself because it is Protocompile-specific.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AST

type AST struct {
	source.Opener // Must be comparable.
	Path          string
}

AST is an incremental.Query for the AST of a Protobuf file.

AST queries with different Openers are considered distinct.

func (AST) Execute

func (a AST) Execute(t *incremental.Task) (*ast.File, error)

Execute implements incremental.Query.

func (AST) Key

func (a AST) Key() any

Key implements incremental.Query.

The key for a Contents query is the query itself. This means that a single incremental.Executor can host Contents queries for multiple Openers. It also means that the Openers must all be comparable. As the [Opener] documentation states, implementations should take a pointer receiver so that comparison uses object identity.

type FDP

type FDP struct {
	*ir.File // Must be comparable.
	fdp.Options
}

FDP is an incremental.Query that converts the lowered IR files *ir.File to *descriptorpb.FileDescriptorProto

FDP queries with different File and Options are considered distinct. The File field must not be edited between different FDP queries!

func (FDP) Execute

Execute implements incremental.Query.

func (FDP) Key

func (l FDP) Key() any

Key implements incremental.Query.

type FDS

type FDS struct {
	source.Opener // Must be comparable.
	*ir.Session
	source.Workspace // Must be comparable
	fdp.Options
}

FDS is an incremental.Query that produces a *descriptorpb.FileDescriptorSet. It takes the IR files ir.File produced via Link, topologically sorts the resulting IR files, and converts each to a *descriptorpb.FileDescriptorProto via FDP. It then bundles them all together into a *descriptorpb.FileDescriptorSet.

FDS queries with different Openers, options, and workspaces are considered distinct.

func (FDS) Execute

Execute implements incremental.Query.

func (FDS) Key

func (l FDS) Key() any

Key implements incremental.Query.

type File

type File struct {
	source.Opener // Must be comparable.
	Path          string

	// If set, any errors generated from opening the file are logged as
	// diagnostics. Setting this to false is useful for cases where the
	// caller wants to emit a more general diagnostic.
	ReportError bool
}

File is an incremental.Query for the contents of a file as provided by a source.Opener.

File queries with different Openers are considered distinct.

func (File) Execute

func (f File) Execute(t *incremental.Task) (*source.File, error)

Execute implements incremental.Query.

func (File) Key

func (f File) Key() any

Key implements incremental.Query.

The key for a File query is the query itself. This means that a single incremental.Executor can host File queries for multiple Openers. It also means that the Openers must all be comparable. As the [Opener] documentation states, implementations should take a pointer receiver so that comparison uses object identity.

type IR

type IR struct {
	source.Opener // Must be comparable.
	*ir.Session
	Path string
	// contains filtered or unexported fields
}

IR is an incremental.Query for the lowered IR of a Protobuf file.

IR queries with different Openers are considered distinct.

func (IR) Execute

func (i IR) Execute(t *incremental.Task) (*ir.File, error)

Execute implements incremental.Query.

func (IR) Key

func (i IR) Key() any

Key implements incremental.Query.

type Link struct {
	source.Opener // Must be comparable.
	*ir.Session
	source.Workspace // Must be comparable.
}

Link is an incremental.Query for the lowered IR files *ir.File of the given Protobuf source workspace source.Workspace. This query links the compilation of the given sources together and allows us to additional checks across the sources, e.g. duplicate symbols and extensions across the given source.Workspace.

Link queries with different [source.Opener]s and/or [source.Workspace]s are considered distinct.

func (Link) Execute

func (l Link) Execute(t *incremental.Task) ([]*ir.File, error)

Execute implements incremental.Query.

func (Link) Key

func (l Link) Key() any

Key implements incremental.Query.

Jump to

Keyboard shortcuts

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