xtype

package
v0.0.0-...-d7bfbf2 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const ThisVar = "c"

ThisVar is used as name for the reference to the converter interface.

Variables

This section is empty.

Functions

This section is empty.

Types

type FieldSources

type FieldSources struct {
	Path []string
	Type *Type
}

type JenID

type JenID struct {
	ParentPointer *JenID
	Code          *jen.Statement
	Variable      bool
}

JenID a jennifer code wrapper with extra infos.

func OtherID

func OtherID(code *jen.Statement) *JenID

OtherID is used, when the ID isn't a variable id.

func VariableID

func VariableID(code *jen.Statement) *JenID

VariableID is used, when the ID can be referenced. F.ex it is not a function call.

type NoMatchError

type NoMatchError struct{ Field string }

func (*NoMatchError) Error

func (err *NoMatchError) Error() string

type Signature

type Signature struct {
	Source string
	Target string
}

Signature represents a signature for conversion.

func SignatureOf

func SignatureOf(source, target *Type) Signature

type SimpleStructField

type SimpleStructField struct {
	Name string
	Type *Type
}

func FindExactField

func FindExactField(source *Type, name string) (*SimpleStructField, error)

type StructField

type StructField struct {
	Path []string
	Type *Type
}

StructField holds the type of a struct field and its name.

func FindField

func FindField(name string, ignoreCase bool, ignored func(name string) bool, source *Type, additionalFieldSources []FieldSources) (*StructField, error)

type Type

type Type struct {
	T             types.Type
	Interface     bool
	InterfaceType *types.Interface
	Struct        bool
	StructType    *types.Struct
	Named         bool
	NamedType     *types.Named
	Pointer       bool
	PointerType   *types.Pointer
	PointerInner  *Type
	List          bool
	ListFixed     bool
	ListInner     *Type
	Map           bool
	MapType       *types.Map
	MapKey        *Type
	MapValue      *Type
	Basic         bool
	BasicType     *types.Basic
}

Type is a helper wrapper for types.Type.

func TypeOf

func TypeOf(t types.Type) *Type

TypeOf creates a Type.

func (*Type) AsPointer

func (t *Type) AsPointer() *Type

func (*Type) ID

func (t *Type) ID() string

ID returns a deteministically generated id that may be used as variable.

func (Type) TypeAsJen

func (t Type) TypeAsJen() *jen.Statement

TypeAsJen returns a jen representation of the type.

func (*Type) UnescapedID

func (t *Type) UnescapedID() string

UnescapedID returns a deteministically generated id that may be used as variable reserved keywords aren't escaped.

Jump to

Keyboard shortcuts

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