field_type

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BasicString  = Basic("string")
	BasicInt     = Basic("int")
	BasicInt32   = Basic("int32")
	BasicInt64   = Basic("int64")
	BasicUint    = Basic("uint")
	BasicUint32  = Basic("uint32")
	BasicUint64  = Basic("uint64")
	BasicFloat32 = Basic("float32")
	BasicFloat64 = Basic("float64")
	BasicBool    = Basic("bool")
	BasicByte    = Basic("byte")
)

Variables

This section is empty.

Functions

func Visit

func Visit(fieldType FieldTyper, visitor Visitor)

Visit ...

func VisitAll

func VisitAll(fieldTypes []FieldTyper, visitor Visitor)

VisitAll ...

Types

type Basic

type Basic string

func ParseBasic

func ParseBasic(t string) (Basic, bool)

func (Basic) Accept

func (b Basic) Accept(v Visitor)

func (Basic) GoName

func (b Basic) GoName() string

func (Basic) GoTypeString

func (b Basic) GoTypeString() string

func (Basic) GoTypeStringWithAlias

func (b Basic) GoTypeStringWithAlias(_ string) string

func (Basic) Kind

func (Basic) Kind() Kind

func (Basic) String

func (b Basic) String() string

func (Basic) Unwraps

func (Basic) Unwraps() []FieldTyper

type Custom

type Custom struct {
	Name string

	// PkgName if empty — not from another pkg
	PkgName string
	// PkgPath if empty — not from another pkg
	PkgPath string
}

func CustomField

func CustomField(name, pkgName, pkgPath string) Custom

func (Custom) Accept

func (c Custom) Accept(visitor Visitor)

func (Custom) GoTypeString

func (c Custom) GoTypeString() string

func (Custom) GoTypeStringWithAlias

func (c Custom) GoTypeStringWithAlias(alias string) string

func (Custom) Kind

func (c Custom) Kind() Kind

func (Custom) String

func (c Custom) String() string

func (Custom) Unwraps

func (c Custom) Unwraps() []FieldTyper

type FieldTyper

type FieldTyper interface {
	Kind() Kind
	Unwraps() []FieldTyper
	GoTypeString() string
	GoTypeStringWithAlias(alias string) string
	Accept(v Visitor)
}

func GenericField

func GenericField(genericType FieldTyper, parameterType FieldTyper) FieldTyper

func PtrField

func PtrField(f FieldTyper) FieldTyper

func SliceField

func SliceField(f FieldTyper) FieldTyper

type Generic

type Generic struct {
	GenericType   FieldTyper
	ParameterType FieldTyper
}

func (Generic) Accept

func (g Generic) Accept(visitor Visitor)

func (Generic) GoTypeString

func (g Generic) GoTypeString() string

func (Generic) GoTypeStringWithAlias

func (g Generic) GoTypeStringWithAlias(alias string) string

func (Generic) Kind

func (g Generic) Kind() Kind

func (Generic) String

func (g Generic) String() string

func (Generic) Unwrap

func (g Generic) Unwrap() FieldTyper

func (Generic) Unwraps

func (g Generic) Unwraps() []FieldTyper

type Kind

type Kind uint
const (
	KindBasic Kind = iota
	KindStruct
	KindCustom
	KindInterface
)

type Ptr

type Ptr struct {
	Field FieldTyper
}

func (Ptr) Accept

func (p Ptr) Accept(v Visitor)

func (Ptr) GoTypeString

func (p Ptr) GoTypeString() string

func (Ptr) GoTypeStringWithAlias

func (p Ptr) GoTypeStringWithAlias(alias string) string

func (Ptr) Kind

func (p Ptr) Kind() Kind

func (Ptr) String

func (p Ptr) String() string

func (Ptr) Unwrap

func (p Ptr) Unwrap() FieldTyper

func (Ptr) Unwraps

func (p Ptr) Unwraps() []FieldTyper

type Slice

type Slice struct {
	Field FieldTyper
}

func (Slice) Accept

func (s Slice) Accept(v Visitor)

func (Slice) GoTypeString

func (s Slice) GoTypeString() string

func (Slice) GoTypeStringWithAlias

func (s Slice) GoTypeStringWithAlias(alias string) string

func (Slice) Kind

func (s Slice) Kind() Kind

func (Slice) String

func (s Slice) String() string

func (Slice) Unwrap

func (s Slice) Unwrap() FieldTyper

func (Slice) Unwraps

func (s Slice) Unwraps() []FieldTyper

type Visitor

type Visitor interface {
	VisitBasic(basic Basic)
	VisitCustom(custom Custom)
	VisitGeneric(generic Generic)
	VisitPtr(ptr Ptr)
	VisitSlice(slice Slice)
}

Visitor ...

Jump to

Keyboard shortcuts

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