xtype

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 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 JenID

type JenID struct {
	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 Signature

type Signature struct {
	Source string
	Target string
	Id     string
}

Signature represents a signature for conversion.

type StructField

type StructField struct {
	Name string
	Type *Type
}

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

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) ID

func (t *Type) ID() string

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

func (Type) StructField

func (t Type) StructField(name string, ignoreCase bool, ignore map[string]struct{}) (*StructField, error)

StructField returns the type of a struct field and its name upon successful match or an error if it is not found. This method will also return a detailed error if matchIgnoreCase is enabled and there are multiple non-exact matches.

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