xtype

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnnamedRecursion = errors.New("xtype: unnamed recursive composite is unsupported")

Functions

func ToAST

func ToAST(n Node, imps *ImportSet) (ast.Expr, error)

Types

type Alias

type Alias struct {
	PkgPath, Name string
	Target        Node
}

func (*Alias) Kind

func (a *Alias) Kind() Kind

type Array

type Array struct {
	Len  int
	Elem Node
}

func (*Array) Kind

func (a *Array) Kind() Kind

type Basic

type Basic struct{ Name, PkgPath string }

func (*Basic) Kind

func (b *Basic) Kind() Kind

type Chan

type Chan struct {
	Dir  int
	Elem Node
}

func (*Chan) Kind

func (c *Chan) Kind() Kind

type Field

type Field struct {
	Name     string
	Type     Node
	Tag      string
	Embedded bool
}

type Func

type Func struct {
	Params, Results []Field
	Variadic        bool
}

func (*Func) Kind

func (f *Func) Kind() Kind

type ImportEntry

type ImportEntry struct{ Alias, Path string }

type ImportSet

type ImportSet struct {
	CurrentPkg string
	// contains filtered or unexported fields
}

func NewImportSet

func NewImportSet(currentPkg string) *ImportSet

func (*ImportSet) Add

func (s *ImportSet) Add(pkgPath string) string

func (*ImportSet) AliasFor

func (s *ImportSet) AliasFor(pkgPath string) string

func (*ImportSet) Entries

func (s *ImportSet) Entries() []ImportEntry

func (*ImportSet) QualIdent

func (s *ImportSet) QualIdent(pkgPath, ident string) ast.Expr

type Interface

type Interface struct{ Methods []Method }

func (*Interface) Kind

func (i *Interface) Kind() Kind

type Kind

type Kind int
const (
	KindUnknown Kind = iota
	KindBasic
	KindNamed
	KindAlias
	KindPointer
	KindSlice
	KindArray
	KindMap
	KindChan
	KindFunc
	KindInterface
	KindStruct
)

func (Kind) String

func (k Kind) String() string

type Map

type Map struct{ Key, Elem Node }

func (*Map) Kind

func (m *Map) Kind() Kind

type Method

type Method struct {
	Name string
	Type Func
}

type Named

type Named struct {
	PkgPath, Name string
	Underlying    Node
}

func (*Named) Kind

func (n *Named) Kind() Kind

type Node

type Node interface{ Kind() Kind }

func FromReflect

func FromReflect(t reflect.Type) (Node, error)

type Pointer

type Pointer struct{ Elem Node }

func (*Pointer) Kind

func (p *Pointer) Kind() Kind

type Slice

type Slice struct{ Elem Node }

func (*Slice) Kind

func (s *Slice) Kind() Kind

type Struct

type Struct struct{ Fields []Field }

func (*Struct) Kind

func (s *Struct) Kind() Kind

Jump to

Keyboard shortcuts

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