Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Basic ¶
type Basic struct{}
Basic handles basic data types.
type BasicTargetPointerRule ¶
type BasicTargetPointerRule struct{}
BasicTargetPointerRule handles edge conditions if the target type is a pointer.
type Builder ¶
type Builder interface { // Matches returns true, if the builder can create handle the given types Matches(source, target *xtype.Type) bool // Build creates conversion source code for the given source and target type. Build(gen Generator, ctx *MethodContext, sourceID *xtype.JenID, source, target *xtype.Type) ([]jen.Code, *xtype.JenID, *Error) }
Builder builds converter implementations, and can decide if it can handle the given type.
type ErrorWrapper ¶
ErrorWrapper generates code that wraps the errors returned from conversion methods, embedding extra details to ease on troubleshooting.
type ExtendMethod ¶
type Generator ¶
type Generator interface { Build( ctx *MethodContext, sourceID *xtype.JenID, source, target *xtype.Type, errWrapper ErrorWrapper) ([]jen.Code, *xtype.JenID, *Error) }
Generator checks all existing builders if they can create a conversion implementations for the given source and target type If no one Builder#Matches then, an error is returned.
type List ¶
type List struct{}
List handles array / slice types.
type Map ¶
type Map struct{}
Map handles map types.
type MethodContext ¶
type MethodContext struct { *namer.Namer Mapping map[string]string ExtendMapping map[string]*ExtendMethod IgnoredFields map[string]struct{} IgnoreUnexportedFields bool IdentityMapping map[string]struct{} Signature xtype.Signature TargetType *xtype.Type PointerChange bool MatchIgnoreCase bool WrapErrors bool }
MethodContext exposes information for the current method.
type Path ¶
type Path struct { Prefix string SourceID string TargetID string SourceType string TargetType string }
Path defines the path inside an error message.
type Pointer ¶
type Pointer struct{}
Pointer handles pointer types.
type Struct ¶
type Struct struct{}
Struct handles struct types.
type TargetPointer ¶
type TargetPointer struct{}
TargetPointer handles type were only the target is a pointer.