attribute

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasAttribute

func HasAttribute(s *astp.Element, attrName string) bool

HasAttribute 是否有特定注释

func RegAttributeType added in v0.2.7

func RegAttributeType(name string, value AttributeType)

Types

type Attribute

type Attribute struct {
	Name  string
	Value string
	Type  AttributeType
	Index int
}

Attribute 注解命令

func GetFieldAttributeAsParamType

func GetFieldAttributeAsParamType(f *astp.Element) []*Attribute

GetFieldAttributeAsParamType 返回参数对应类型上的注解

func GetLastAttr

func GetLastAttr(f *astp.Element) *Attribute

GetLastAttr 返回参数类型上注解的最后一个

func GetMethodAttributes

func GetMethodAttributes(m *astp.Element) []*Attribute

GetMethodAttributes 解析方法上的注释

func GetMethodAttributesAsMiddleware

func GetMethodAttributesAsMiddleware(m *astp.Element) []*Attribute

GetMethodAttributesAsMiddleware 提取方法上的中间件标记

func GetStructAttrAsMiddleware

func GetStructAttrAsMiddleware(s *astp.Element) []*Attribute

GetStructAttrAsMiddleware 返回结构体上的中间件类attr

func GetStructAttrByName

func GetStructAttrByName(s *astp.Element, attrName string) *Attribute

GetStructAttrByName 按attr名称返回,不存在则返回nil

func GetStructAttrs

func GetStructAttrs(s *astp.Element) []*Attribute

GetStructAttrs 获取结构体的注释

func ParseDoc

func ParseDoc(doc []string, name string) []*Attribute

ParseDoc 解析注解

type AttributeType

type AttributeType int
const (
	TypeHttpMethod AttributeType = iota //http 请求方法
	TypeOther                           //其他
	TypeDoc                             //注释内容
	TypeMiddleware                      //中间件类
	TypeParam                           //方法的参数和返回值专用
	TypeTagger                          //这种类型仅用于标记一些元素
	TypeInner
)

Jump to

Keyboard shortcuts

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