Documentation
¶
Index ¶
- Constants
- func Generate(dir string) error
- func GenerateToFile(dir, outputFile string) error
- func GetAnnotationValue(doc *CommentGroup, name string) string
- func GetTag(tags map[string]string, key string) string
- func HasAnnotation(doc *CommentGroup, name string) bool
- func HasTag(tags map[string]string, key string) bool
- func ParseAnnotations(doc *CommentGroup) []string
- type Annotation
- type AutoRegGenerator
- type Comment
- type CommentGroup
- type Const
- type Enum
- type EnumValue
- type Field
- type Func
- type Generator
- type GenericArg
- type GenericParam
- type GenericSpec
- type Loader
- type ModuleInfo
- type Package
- type Param
- type Parser
- type Project
- type Query
- func (q *Query) FindByAnnotation(annotation string) []interface{}
- func (q *Query) FindByTag(tagKey string) []*Field
- func (q *Query) FindEnum(name string) *Enum
- func (q *Query) FindFieldsByTag(tagKey, tagValue string) []*Field
- func (q *Query) FindFunc(name string) *Func
- func (q *Query) FindFuncsByAnnotation(annotation string) []*Func
- func (q *Query) FindImplementations(interfaceName string) []*Type
- func (q *Query) FindType(name string) *Type
- func (q *Query) FindTypeByPath(pkgPath, name string) *Type
- func (q *Query) FindTypesByAnnotation(annotation string) []*Type
- func (q *Query) GetEnumValues(enumName string) []*EnumValue
- func (q *Query) GetInterface(name string) *Type
- func (q *Query) GetMethodParams(method *Func) (params, results []*Type)
- func (q *Query) GetStruct(name string) *Type
- func (q *Query) ListEnums() []*Enum
- func (q *Query) ListPackages() []string
- func (q *Query) ListTypes(pkgPath string) []*Type
- func (q *Query) ResolveFieldType(field *Field) *Type
- func (q *Query) ResolveParamType(param *Param) *Type
- func (q *Query) ResolveTypeRef(ref *TypeRef) *Type
- type Type
- type TypeKind
- type TypeRef
- type Var
Constants ¶
View Source
const DefaultAutoRegOutputFile = "fw_autoreg_gen.go"
View Source
const DefaultOutputFile = ".astp.json"
Variables ¶
This section is empty.
Functions ¶
func GenerateToFile ¶
func GetAnnotationValue ¶
func GetAnnotationValue(doc *CommentGroup, name string) string
func HasAnnotation ¶
func HasAnnotation(doc *CommentGroup, name string) bool
func ParseAnnotations ¶
func ParseAnnotations(doc *CommentGroup) []string
Types ¶
type Annotation ¶
type Annotation struct {
Name string `json:"name"`
Raw string `json:"raw,omitempty"`
Args []string `json:"args,omitempty"`
KV map[string]string `json:"kv,omitempty"`
}
func GetAnnotation ¶
func GetAnnotation(doc *CommentGroup, name string) *Annotation
func GetAnnotations ¶
func GetAnnotations(doc *CommentGroup, name string) []*Annotation
type AutoRegGenerator ¶
type AutoRegGenerator struct {
ExportedOnly bool
// contains filtered or unexported fields
}
func NewAutoRegGenerator ¶
func NewAutoRegGenerator() *AutoRegGenerator
type CommentGroup ¶
type CommentGroup struct {
List []*Comment `json:"list,omitempty"`
Annotations []string `json:"annotations,omitempty"`
ParsedAnnotations []*Annotation `json:"parsed_annotations,omitempty"`
}
type Const ¶
type Const struct {
Name string `json:"name"`
PkgPath string `json:"pkg_path"`
Type *TypeRef `json:"type,omitempty"`
Value string `json:"value,omitempty"`
Doc *CommentGroup `json:"doc,omitempty"`
}
type Enum ¶
type Enum struct {
Name string `json:"name"`
PkgPath string `json:"pkg_path"`
Type *TypeRef `json:"type,omitempty"`
Values []*EnumValue `json:"values"`
Doc *CommentGroup `json:"doc,omitempty"`
}
type EnumValue ¶
type EnumValue struct {
Name string `json:"name"`
Value string `json:"value,omitempty"`
Doc *CommentGroup `json:"doc,omitempty"`
}
type Func ¶
type Func struct {
Name string `json:"name"`
PkgPath string `json:"pkg_path"`
Recv *TypeRef `json:"recv,omitempty"`
Params []*Param `json:"params,omitempty"`
Results []*Param `json:"results,omitempty"`
Generic *GenericSpec `json:"generic,omitempty"`
Doc *CommentGroup `json:"doc,omitempty"`
Signatures []string `json:"signatures,omitempty"`
}
type Generator ¶
type Generator struct {
ExportedOnly bool
// contains filtered or unexported fields
}
func NewGenerator ¶
func NewGenerator() *Generator
type GenericArg ¶
type GenericArg struct {
Args []*TypeRef `json:"args"`
}
type GenericParam ¶
type GenericSpec ¶
type GenericSpec struct {
Params []*GenericParam `json:"params"`
}
type ModuleInfo ¶
type Project ¶
func LoadFromBytes ¶
LoadFromBytes parses a Project from in-memory JSON data. This is typically used with go:embed to load pre-generated .astp.json without requiring the file to exist on disk.
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
func (*Query) FindByAnnotation ¶
func (*Query) FindFieldsByTag ¶
func (*Query) FindFuncsByAnnotation ¶
func (*Query) FindImplementations ¶
func (*Query) FindTypeByPath ¶
func (*Query) FindTypesByAnnotation ¶
func (*Query) GetEnumValues ¶
func (*Query) GetInterface ¶
func (*Query) GetMethodParams ¶
func (*Query) ListPackages ¶
func (*Query) ResolveFieldType ¶
func (*Query) ResolveParamType ¶
func (*Query) ResolveTypeRef ¶
type Type ¶
type Type struct {
Name string `json:"name"`
PkgPath string `json:"pkg_path"`
Kind TypeKind `json:"kind"`
Fields []*Field `json:"fields,omitempty"`
Methods []*Func `json:"methods,omitempty"`
Embedded []*TypeRef `json:"embedded,omitempty"`
Implements []string `json:"implements,omitempty"`
Generic *GenericSpec `json:"generic,omitempty"`
AliasOf *TypeRef `json:"alias_of,omitempty"`
KeyType *TypeRef `json:"key_type,omitempty"`
ElemType *TypeRef `json:"elem_type,omitempty"`
Doc *CommentGroup `json:"doc,omitempty"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.