reflect

package
v0.0.0-...-69d094b Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package reflect 基于 reflect 库实现一些方便的功能

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TypeDesc

type TypeDesc struct {
	// 类型名称
	TypeName string `json:"type_name"`
	// package 名称
	PackageName string `json:"package_name"`
	// 指针层级, 也就是 * 的个数
	PointerLevels int `json:"pointer_levels"`
	// 包路径信息
	Path struct {
		Prefix string `json:"prefix,omitempty"` // 相当于 dir 部分
		Full   string `json:"full,omitempty"`   // 完整的 path + package 路径名
	} `json:"path"`
	// contains filtered or unexported fields
}

TypeDesc 描述一个类型的各种信息

func DescribeType

func DescribeType(v any) TypeDesc

DescribeType 描述一个类型

func (TypeDesc) Kind

func (t TypeDesc) Kind() reflect.Kind

Kind 返回类型的 Kind

func (TypeDesc) MarshalJSON

func (t TypeDesc) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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