plan

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FieldMapping

type FieldMapping struct {
	DstName            string
	SrcName            string
	DstType            types.Type
	SrcType            types.Type
	Op                 Operation
	TransformFunc      string
	TransformHasError  bool
	TransformImportPkg string // e.g., "strings" or full import path
	TransformFuncName  string // e.g., "ToUpper"
	// For composite types
	ElemSrc types.Type // slice element or map value
	ElemDst types.Type // slice element or map value
	KeySrc  types.Type // map key
	KeyDst  types.Type // map key
}

type Operation

type Operation int
const (
	OpDirectAssign  Operation = iota // identical or assignable types
	OpConvert                        // requires a conversion to destination type
	OpAddrOf                         // dst is *T, src is T
	OpAddrOfConvert                  // dst is *T, src is S convertible to T
	OpDeref                          // dst is T, src is *T
	OpDerefConvert                   // dst is T, src is *S convertible to T
	OpSliceAssign                    // []S -> []D where S assignable to D
	OpSliceConvert                   // []S -> []D where S convertible to D
	OpMapAssign                      // map[K]V -> map[K]V assignable key/value
	OpTransform                      // call custom transform function: dst = Fn(src)
	OpTransformErr                   // call transform that returns (Out, error)
	OpRecurseStruct                  // nested struct mapping via local helper
)

type Options

type Options struct {
	Verbose       bool
	AllowWidening bool
}

type Plan

type Plan struct {
	Mappings []FieldMapping
	Skipped  []SkipReason
}

func BuildTrivialPlan

func BuildTrivialPlan(a *analyze.Analysis, opt Options) (*Plan, error)

BuildTrivialPlan matches same-named fields and uses DirectAssign when types are assignable.

type SkipReason

type SkipReason struct {
	DstName string
	Reason  string
}

Jump to

Keyboard shortcuts

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