Documentation ¶
Index ¶
- func HandwrittenMapperName(destinationFieldName string) string
- type Field
- type FieldInput
- type Fields
- type FieldsInput
- type Generated
- type Generator
- type Import
- type Imports
- type Input
- type Mapper
- type Mapping
- type Mappings
- type Method
- type Methods
- type Package
- type ParsedField
- type ParsedFields
- type ParsedFunction
- type ParsedFunctions
- type ParsedStruct
- type Parser
- type RegisteredTypeInput
- type RegisteredTypesInput
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandwrittenMapperName ¶
Types ¶
type Field ¶
type Field struct {
// contains filtered or unexported fields
}
func (Field) DesiredName ¶
func (Field) OriginalName ¶
OriginalName Returns name of a field as it was parsed from source.
func (Field) OverrideTypeTo ¶
type FieldInput ¶
type FieldsInput ¶
type FieldsInput []FieldInput
type Import ¶
type Import struct {
// contains filtered or unexported fields
}
func NewImport ¶
func NewImport(i *ast.ImportSpec) Import
type Input ¶
type Input struct { // PackagePath Import path to package in which source object is present. PackagePath string // TypeName Name of DTO in the source. TypeName string // RenameTypeTo Desired name of a DTO. If empty, original name will be used. RenameTypeTo string // If IncludeAllParsedFields is set to true, all fields, no matter if they are present in Fields, will be included. IncludeAllParsedFields bool // Fields Specifies which fields should be included in new DTO. Each field can be renamed, or have override type. Fields FieldsInput // If SkipMapper is set to true, mapper will not be generated. SkipMapper bool // OutputPackagePath Import path to where DTO will be generated. OutputPackagePath string // OutputPackage Overrides output package name. OutputPackage string }
Input
Required: - PackagePath - TypeName - IncludeAllParsedFields or Fields. Both can be present, if you want to include all fields, and rename some of them. - OutputPackagePath
type Mapper ¶
type Mapper struct { // SourceTypeName Name of a struct we are mapping from. SourceTypeName string // SourceImportName Name of an import of struct we are mapping from. SourceImportName string // DestinationTypeName Name of a struct we are mapping to. DestinationTypeName string Mappings Mappings Helpers ParsedFunctions }
type Mapping ¶
type Mapping struct {
// contains filtered or unexported fields
}
func (Mapping) Destination ¶
func (Mapping) IsFunction ¶
type Method ¶
type Method struct {
// contains filtered or unexported fields
}
func (Method) IsExported ¶
type ParsedField ¶
type ParsedField struct {
// contains filtered or unexported fields
}
func NewParsedField ¶
func NewParsedField(name string, _type ast.Expr) ParsedField
func (ParsedField) Name ¶
func (f ParsedField) Name() string
func (ParsedField) Type ¶
func (f ParsedField) Type() ast.Expr
type ParsedFields ¶
type ParsedFields []ParsedField
type ParsedFunction ¶
type ParsedFunction struct {
// contains filtered or unexported fields
}
func NewParsedFunction ¶
func NewParsedFunction(name, body string) ParsedFunction
func (ParsedFunction) Code ¶
func (pf ParsedFunction) Code() string
type ParsedFunctions ¶
type ParsedFunctions []ParsedFunction
type ParsedStruct ¶
type ParsedStruct struct { Name string Fields ParsedFields Methods Methods Imports Imports Package Package }
type Parser ¶
type Parser interface { LoadPackage(importPath string) (Parser, error) GetStruct(typeName string) (*ParsedStruct, error) GetFunctions() (ParsedFunctions, Imports, error) }
type RegisteredTypeInput ¶
type RegisteredTypesInput ¶
type RegisteredTypesInput []RegisteredTypeInput
Click to show internal directories.
Click to hide internal directories.