xtype

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 6 Imported by: 3

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

func Accessible added in v1.2.0

func Accessible(obj types.Object, outputPackagePath string) bool

Accessible checks if obj is accessible within outputPackagePath.

func Unalias added in v1.4.0

func Unalias(t types.Type) types.Type

Types

type Enum added in v1.4.0

type Enum struct {
	enum.Enum
	OK bool
}

func (Enum) SortedMembers added in v1.4.0

func (e Enum) SortedMembers() []string

type FieldSources added in v0.15.0

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.

func (*JenID) Pointer added in v1.1.0

func (j *JenID) Pointer(t *Type, namer func(string) string) ([]jen.Code, *JenID)

type NoMatchError added in v0.16.0

type NoMatchError struct{ Field string }

func (*NoMatchError) Error added in v0.16.0

func (err *NoMatchError) Error() string

type Signature

type Signature struct {
	Source string
	Target string
}

Signature represents a signature for conversion.

func SignatureOf added in v0.14.0

func SignatureOf(source, target *Type) Signature

type SimpleStructField added in v0.15.0

type SimpleStructField struct {
	Name string
	Type *Type
}

func FindExactField added in v0.15.0

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

type StructField added in v0.6.0

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

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

func FindField added in v0.15.0

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

type Type

type Type struct {
	String        string
	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
	Signature     bool
	SignatureType *types.Signature
	Func          bool
	FuncType      *types.Func
	// contains filtered or unexported fields
}

Type is a helper wrapper for types.Type.

func TypeOf

func TypeOf(t types.Type) *Type

TypeOf creates a Type.

func (*Type) AsPointer added in v0.14.0

func (t *Type) AsPointer() *Type

func (*Type) AsPointerType added in v1.2.0

func (t *Type) AsPointerType() *types.Pointer

func (*Type) AssignableTo added in v1.3.0

func (t *Type) AssignableTo(other *Type) bool

func (*Type) Enum added in v1.4.0

func (t *Type) Enum(cfg *enum.Config) *Enum

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