comments

package
v0.0.0-...-d7bfbf2 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Converter

type Converter struct {
	Name    string
	Config  ConverterConfig
	Methods MethodMapping
	Scope   *types.Scope
}

Converter defines a converter that was marked with converterMarker.

func ParseDocs

func ParseDocs(config ParseDocsConfig) ([]Converter, error)

ParseDocs parses the docs for the given pattern.

type ConverterConfig

type ConverterConfig struct {
	Name          string
	ExtendMethods []string
	Flags         builder.ConversionFlags
}

ConverterConfig contains settings that can be set via comments.

type FieldMapping

type FieldMapping struct {
	Source   string
	Function string
	Ignore   bool
}

type Method

type Method struct {
	Flags   builder.ConversionFlags
	AutoMap []string
	Fields  map[string]*FieldMapping
}

Method contains settings that can be set via comments.

func (*Method) Field

func (m *Method) Field(targetName string) *FieldMapping

type MethodMapping

type MethodMapping map[string]Method

MethodMapping a mapping between method name and method.

type ParseDocsConfig

type ParseDocsConfig struct {
	// PackagePattern is a golang package pattern to scan, required.
	PackagePattern string
	// WorkingDir is a directory to invoke the tool on. If omitted, current directory is used.
	WorkingDir string
}

ParseDocsConfig provides input to the ParseDocs method below.

Jump to

Keyboard shortcuts

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