gen

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(manifestPath string) error

Generate generates the mapping files.

Types

type ConvertFunctionParams

type ConvertFunctionParams struct {
	ConverterPackage     string
	FunctionName         string
	FunctionNameForSlice string
	SourcePackage        string
	SourceObjectName     string
	FQSourceObjectName   string
	TargetPackage        string
	TargetObjectName     string
	FQTargetObjectName   string
	Assignments          []string
	Imports              []string
}

ConvertFunctionParams is a struct that contains the parameters that feed into the template.

type Manifest

type Manifest struct {
	ProjectRoot      string      `yaml:"project_root"`
	GeneratorPath    string      `yaml:"generator_path"`
	GeneratorPackage string      `yaml:"generator_package"`
	ObjectMaps       []ObjectMap `yaml:"maps"`
}

Manifest strongly typed respresentation of the manifest file.

func LoadManifest

func LoadManifest(path string) Manifest

LoadManifest loads the manifest file and returns a slice of ObjectMap structs.

type MapOverride

type MapOverride struct {
	SourceName string `yaml:"source_name"`
	TargetName string `yaml:"target_name"`
}

MapOverride struct that represents an explicitly specified object mapping, overriding the defailt name matching

type ObjectMap

type ObjectMap struct {
	Name          string `yaml:"name"`
	SourcePath    string `yaml:"source_path"`
	SourceObjects []csgen.Struct
	TargetPath    string `yaml:"target_path"`
	TargetObjects []csgen.Struct
	Imports       []string      `yaml:"imports"`
	MapOverrides  []MapOverride `yaml:"map_overrides"`
}

ObjectMap is a struct that contains the source and destination paths for a single mapping.

Jump to

Keyboard shortcuts

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