Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateConverter ¶
func GenerateConverter(c GenerateConfig) ([]byte, error)
GenerateConverter generates converters.
func GenerateConverterFile ¶
func GenerateConverterFile(fileName string, c GenerateConfig) error
GenerateConverterFile generates converters and writes them to a file.
Types ¶
type GenerateConfig ¶
type GenerateConfig struct { // PackageName is the package to use for the generated code. PackageName string // ScanDir is the package with golang files to scan for goverter tags. ScanDir string // ExtendMethods is a list of extensions to load in addition to goverter:extend statements // declared on the interface itself. ExtendMethods []string // WorkingDir is the working directory (usually the location of go.mod file), can be empty. WorkingDir string // PackagePath is the full package where the generated code is going to be stored, can be empty. // PackagePath is needed if goverter:extend tags use exported methods from the package where // generated code resides, making sure goverter does not create a loop import statement from // the generated code into its own package. PackagePath string // WrapErrors instructs goverter to wrap conversion errors and return more details when such // are available. For examples, for structs, target field name is reported, for slices: index. WrapErrors bool // IgnoredUnexportedFields tells goverter to ignore fields that are not exported. IgnoredUnexportedFields bool // MatchFieldsIgnoreCase tells goverter to use case insensitive match everywhere. MatchFieldsIgnoreCase bool }
GenerateConfig the config for generating a converter.
Click to show internal directories.
Click to hide internal directories.