attribute

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMethodAttributeType

func AddMethodAttributeType(name string, typ AttributeType)

func AddStructAttributeType

func AddStructAttributeType(name string, t AttributeType)

func HasAttribute

func HasAttribute(s *astp.Struct, name string) bool

Types

type Attribute

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

Attribute 注解命令

func GetFieldAttributeAsParamType

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

func GetLastAttr

func GetLastAttr(f *astp.ParamField) *Attribute

func GetMethodAttributes

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

func GetMethodAttributesAsMiddleware

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

func GetStructAttrAsMiddleware

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

func GetStructAttrByName

func GetStructAttrByName(s *astp.Struct, name string) *Attribute

func GetStructAttrs

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

func ParseDoc

func ParseDoc(doc []string, name string, i map[string]AttributeType) []*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