types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

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