Documentation
¶
Overview ¶
Package convert provides a function to generate conversion functions for a vehicle struct.
Index ¶
Constants ¶
View Source
const (
// DefaultConversionFile is the default name of the conversion file.
DefaultConversionFile = "convert-funcs_gen.go"
)
Variables ¶
This section is empty.
Functions ¶
func Generate ¶
func Generate(tmplData *schema.TemplateData, cfg Config) (err error)
Generate creates a conversion functions for each field of a model struct. as well as the entire model struct.
func GetDeclaredFunctions ¶ added in v0.3.0
func GetDeclaredFunctions(outputPath string) (map[string]FunctionInfo, error)
GetDeclaredFunctions returns a map of function names to their corresponding function information for a given directory. The function information includes comments and body.
Types ¶
type Config ¶
type Config struct { // CopyComments determines if comments for the conversion functions should be copied through. CopyComments bool // OutputFile is the output directory for the generated conversion files. // if empty, the base output directory is used. OutputFile string // PackageName is the name of the package to generate the conversion functions. PackageName string }
Config is the configuration for the conversion generator.
type FunctionInfo ¶ added in v0.3.0
Click to show internal directories.
Click to hide internal directories.