types

package
v0.0.0-...-1ad3d4c Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FieldProcessor

type FieldProcessor interface {
	Process(n *types.Named, f *types.Var, tag string, comment string, parentFields ...string) error
}

FieldProcessor takes all information related to a field and processes it.

type FieldProcessorChain

type FieldProcessorChain []FieldProcessor

FieldProcessorChain runs multiple FieldProcessor in order.

func (FieldProcessorChain) Process

func (fpc FieldProcessorChain) Process(n *types.Named, f *types.Var, tag, comment string, parentFields ...string) error

Process run Process method of all FieldProcessor.

type NamedProcessor

type NamedProcessor interface {
	Process(n *types.Named, comment string) error
}

NamedProcessor takes a named struct with its comments and processes it. For example, you might want to take an action depending on its comments or make an in-place change on the *types.Named object if it satisfies certain criteria.

type NamedProcessorChain

type NamedProcessorChain []NamedProcessor

NamedProcessorChain runs multiple NamedProcessors in order.

func (NamedProcessorChain) Process

func (tpc NamedProcessorChain) Process(n *types.Named, comment string) error

Process run Process method of all NamedProcessors.

type ProcessorConfig

type ProcessorConfig struct {
	Named NamedProcessor
	Field FieldProcessor
}

ProcessorConfig lets you configure what processors will be run in given traversal.

type Traverser

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

Traverser goes through all fields of given type recursively. It runs the field processor for every field and named processor for every type it encounters during its depth-first traversal.

func NewTraverser

func NewTraverser(c comments.Comments) *Traverser

NewTraverser returns a new Traverser.

func (*Traverser) Traverse

func (t *Traverser) Traverse(n *types.Named, cfg *ProcessorConfig, parentFields ...string) error

Traverse traverser given type recursively and runs given processors.

Jump to

Keyboard shortcuts

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