astutil

package
v0.0.0-...-76410fa Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AstInspect

type AstInspect struct {
	Pattern []string // 匹配路径
	Type    []string // 枚举类型
	Tags    []string // 编译标签
	// contains filtered or unexported fields
}

func (*AstInspect) Enums

func (g *AstInspect) Enums() *enum_spec.Enums

func (*AstInspect) Init

func (g *AstInspect) Init() error

func (*AstInspect) PackageName

func (g *AstInspect) PackageName() string

type File

type File struct {
	Pkg         *Package
	File        *ast.File
	TypeName    string
	TypeComment string
	Type        string
	Values      []*Value
	OmitZero    bool
}

func (*File) GenDecl

func (f *File) GenDecl(node ast.Node) bool

GenDecl processes one declaration clause.

type Package

type Package struct {
	Name  string
	Defs  map[*ast.Ident]types.Object
	Files []*File
}

type SortValues

type SortValues []*Value

SortValues 使我们可以将`constants`进行排序 字符串不排序, 整型谨慎地按照有符号或无符号的顺序进行恰当的排序

func (SortValues) Clone

func (vs SortValues) Clone() SortValues

func (SortValues) Len

func (b SortValues) Len() int

func (SortValues) Less

func (b SortValues) Less(i, j int) bool

func (SortValues) Swap

func (b SortValues) Swap(i, j int)

type Value

type Value struct {
	OriginalName string // 常量定义的名称
	Label        string // 注释, 如果没有, 则同常量名称
	// value相关
	Const    string // 值, string unquote.
	RawValue string // `constant`的字符串值,由"go/constant"包提供,  string quote.
	// contains filtered or unexported fields
}

Value represents a declared constant.

func (*Value) String

func (v *Value) String() string

Jump to

Keyboard shortcuts

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