types

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: Apache-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterType

func RegisterType(t *Type)

Types

type Embedder

type Embedder interface {
	EmbedFS() *embed.FS
}

Embedder represents embedder

type FSEmbedder

type FSEmbedder struct {
	// contains filtered or unexported fields
}

FSEmbedder represents fs embedder

type Field

type Field struct {
	// Name is the field name.
	Name string
	// PkgPath is the package path that qualifies a lower case (unexported)
	// field name. It is empty for upper case (exported) field names.
	PkgPath   string
	Type      ReflectType       // field type
	Tag       reflect.StructTag // field tag string
	Offset    uintptr           // offset within struct, in bytes
	Index     []int             // index sequence for Type.FieldByIndex
	Anonymous bool              // is an embedded field
}

type MapType

type MapType struct {
	KeyType   reflect.Type
	ValueType *ReflectType
}

type Option

type Option func(p *Type)

func WithEmbedder

func WithEmbedder(e Embedder) Option

func WithName

func WithName(name string) Option

func WithPackage

func WithPackage(pkg string) Option

type ReflectType

type ReflectType struct {
	Type  reflect.Type // underlying type
	IsPtr bool
	*SliceType
	*MapType
	*StructType
}

type SliceType

type SliceType struct {
	ElementType *ReflectType
}

type StructType

type StructType struct {
	Method   []reflect.Method
	Field    []Field
	Embedder // if needed
}

type TagGenerator

type TagGenerator func(field *reflect.StructField, embedder Embedder) reflect.StructTag

type Type

type Type struct {
	Name    string
	Package string // import package alias, e.g. "mypkg"
	PkgPath string // PkgPath is the package path of the type, e.g. "github.com/repo/project/mypkg"

	CompiledType  *ReflectType
	GeneratedType *ReflectType // created by reflect.StructOf
	Embedder      Embedder     // if type has dependency on fs embedder
}

func LookupType

func LookupType(name string) (*Type, bool)

func NewType

func NewType(rType reflect.Type, opts ...Option) *Type

func (*Type) ElementType

func (t *Type) ElementType() reflect.Type

func (*Type) FullName

func (t *Type) FullName() string

func (*Type) Type

func (t *Type) Type() reflect.Type

Jump to

Keyboard shortcuts

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