Documentation ¶
Overview ¶
Package nodes provides Beam transformations over *scpb.Nodes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromEntries ¶
func FromEntries(s beam.Scope, entries beam.PCollection) beam.PCollection
FromEntries transforms a PCollection of *ppb.Entry protos into *scpb.Nodes.
Types ¶
type Filter ¶ added in v0.0.28
type Filter struct { // FilterByKind, if non-nil, configures the filter to only pass through nodes // that match one of the given kinds. FilterByKind []string // FilterBySubkind, if non-nil, configures the filter to only pass through // nodes that match one of the given subkinds. FilterBySubkind []string // IncludeFacts, if non-nil, configures the filter to remove all facts not // explicitly contained with the slice. IncludeFacts []string // IncludeEdges, if non-nil, configures the filter to remove all edges with a // kind not explicitly contained with the slice. IncludeEdges []string }
Filter is a beam DoFn that emits *scpb.Nodes matching a set of kinds/subkinds. Optionally, each processed node's facts/edges will also be filtered to the desired set.
The semantics of the Filter are such that a "zero"-value Filter will pass all Nodes through unaltered. Each part of the filter only applies if set to a non-nil value and all parts are applied independently.
Examples:
Emit only "record" nodes with the "class" subkind with all their facts/edges: &Filter { FilterByKind: []string{"record"}, FilterBySubkind: []string{"class"}, } Emit only "anchor" nodes (any subkind) with all their facts/edges: &Filter {FilterByKind: []string{"anchor"}} Emit only "anchor" nodes with only the loc/{start,end} facts and no edges: &Filter { FilterByKind: []string{"anchor"}, IncludeFacts: []string{"/kythe/loc/start", "/kythe/loc/end"}, IncludeEdges: []string{}, } Emit only "anchor" nodes with their "childof" edges (but all their facts): &Filter { FilterByKind: []string{"anchor"}, IncludeEdges: []string{"/kythe/edge/childof"}, } Emit all nodes without any of their edges (but all their facts): &Filter {IncludeEdges: []string{}}
Click to show internal directories.
Click to hide internal directories.