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.
func (*BasicTargetPointerRule) Build ¶
func (*BasicTargetPointerRule) Build(gen Generator, ctx *MethodContext, sourceID *xtype.JenID, source, target *xtype.Type) ([]jen.Code, *xtype.JenID, *Error)
Build creates conversion source code for the given source and target type.
func (*BasicTargetPointerRule) Matches ¶
func (*BasicTargetPointerRule) Matches(source, target *xtype.Type, _ xtype.MethodKind) bool
Matches returns true, if the builder can create handle the given types.
type Builder ¶
type Builder interface { // Matches returns true, if the builder can create handle the given types Matches(source, target *xtype.Type, kind xtype.MethodKind) 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 Generator ¶
type Generator interface { Build(ctx *MethodContext, sourceID *xtype.JenID, source, target *xtype.Type) ([]jen.Code, *xtype.JenID, *Error) BuildWithExtend(ctx *MethodContext, sourceID *xtype.JenID, source, target *xtype.Type) ( ok bool, codes []jen.Code, id *xtype.JenID, err *Error, ) Name() string }
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 IgnoredFields map[string]struct{} IdentityMapping map[string]struct{} GlobalExtend map[xtype.Signature]*MethodDefinition MethodExtend map[xtype.Signature]*MethodDefinition SearchTag []string Signature xtype.Signature TargetType *xtype.Type WantMethodKind xtype.MethodKind MatchIgnoreCase bool NoStrict bool IgnoreUnexported bool TargetID *xtype.JenID ID string }
MethodContext exposes information for the current method.
func (*MethodContext) Enter ¶
func (m *MethodContext) Enter() *MethodContext
func (*MethodContext) EnterWithNamer ¶ added in v1.0.2
func (m *MethodContext) EnterWithNamer() *MethodContext
type MethodDefinition ¶
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.
func (*TargetPointer) Build ¶
func (*TargetPointer) Build(gen Generator, ctx *MethodContext, sourceID *xtype.JenID, source, target *xtype.Type) ([]jen.Code, *xtype.JenID, *Error)
Build creates conversion source code for the given source and target type.
func (*TargetPointer) Matches ¶
func (*TargetPointer) Matches(source, target *xtype.Type, kind xtype.MethodKind) bool
Matches returns true, if the builder can create handle the given types.
type TargetStruct ¶
type TargetStruct struct{}
func (*TargetStruct) Matches ¶
func (t *TargetStruct) Matches(source, target *xtype.Type, kind xtype.MethodKind) bool
type ZeroCopyStruct ¶
type ZeroCopyStruct struct{}
func (*ZeroCopyStruct) Matches ¶
func (z *ZeroCopyStruct) Matches(source, target *xtype.Type, kind xtype.MethodKind) bool