Documentation
¶
Index ¶
- Variables
- type Annotation
- type AnnotationExtend
- type AnnotationParam
- type AnnotationType
- type Annotations
- type BaseGenerator
- func (bg *BaseGenerator[T]) ExecuteTemplate(wr io.Writer, name string) error
- func (bg *BaseGenerator[T]) GetImports() []string
- func (bg *BaseGenerator[T]) WriteBody(wr io.Writer) error
- func (bg *BaseGenerator[T]) WriteConst(wr io.Writer) error
- func (bg *BaseGenerator[T]) WriteInitFunc(wr io.Writer) error
- type Bool
- type Boolean
- type FileInfo
- type Float
- type Generator
- type GeneratorFactory
- type IOrder
- type Int
- type Order
- type Slice
- type String
- type TypedAnnotation
- type Uint
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidAnnotationType = errors.New("not a valid AnnotationType")
View Source
var ErrInvalidOrder = errors.New("not a valid Order")
Functions ¶
This section is empty.
Types ¶
type Annotation ¶
type Annotation struct {
Doc []string
Name string
Params []*AnnotationParam
Extends []*AnnotationExtend
Comment string
}
func (*Annotation) To ¶
func (a *Annotation) To(t any) (err error)
type AnnotationExtend ¶
type AnnotationExtend struct {
Doc []string
Name string
Values []structure.ValueWrapper
Value structure.ValueWrapper
Comment string
}
type AnnotationParam ¶
type AnnotationParam struct {
Doc []string
Key string
Value structure.ValueWrapper
Comment string
}
type AnnotationType ¶
type AnnotationType int
@Enum {
global
type
func
funcRecv
funcField
}
const ( // AnnotationTypeGlobal is an AnnotationType of type global. AnnotationTypeGlobal AnnotationType = iota // AnnotationTypeType is an AnnotationType of type type. AnnotationTypeType // AnnotationTypeFunc is an AnnotationType of type func. AnnotationTypeFunc // AnnotationTypeFuncRecv is an AnnotationType of type funcRecv. AnnotationTypeFuncRecv // AnnotationTypeFuncField is an AnnotationType of type funcField. AnnotationTypeFuncField )
func ParseAnnotationType ¶
func ParseAnnotationType(value string) (AnnotationType, error)
ParseAnnotationType converts a string to an AnnotationType.
func (AnnotationType) IsValid ¶
func (x AnnotationType) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (AnnotationType) Name ¶
func (x AnnotationType) Name() string
Name is the attribute of AnnotationType.
func (AnnotationType) String ¶
func (x AnnotationType) String() string
String implements the Stringer interface.
func (AnnotationType) Val ¶
func (x AnnotationType) Val() int
Val is the attribute of AnnotationType.
type Annotations ¶
type Annotations struct {
Annotations []*Annotation
}
func (*Annotations) FindAnnotationByName ¶
func (anns *Annotations) FindAnnotationByName(name string) *Annotation
type BaseGenerator ¶
func (*BaseGenerator[T]) ExecuteTemplate ¶
func (bg *BaseGenerator[T]) ExecuteTemplate(wr io.Writer, name string) error
func (*BaseGenerator[T]) GetImports ¶
func (bg *BaseGenerator[T]) GetImports() []string
func (*BaseGenerator[T]) WriteConst ¶
func (bg *BaseGenerator[T]) WriteConst(wr io.Writer) error
func (*BaseGenerator[T]) WriteInitFunc ¶
func (bg *BaseGenerator[T]) WriteInitFunc(wr io.Writer) error
type FileInfo ¶
type FileInfo struct {
ModuleName string
ModuleAbsLocalPath string
FileFullPath string
FileFullAbsLocalPath string
}
func GetFileInfo ¶
type GeneratorFactory ¶
type GeneratorFactory interface {
Annotations() map[string][]AnnotationType // a map of name -> []AnnotationType
New([]*TypedAnnotation) (Generator, error)
}
type Order ¶
type Order int
Order
@Enum {
First = 0
High = 10
AboveNormal = 20
Normal = 30
BelowNormal = 40
}
const ( // OrderFirst is an Order of type First. OrderFirst Order = 0 // OrderHigh is an Order of type High. OrderHigh Order = 10 // OrderAboveNormal is an Order of type AboveNormal. OrderAboveNormal Order = 20 // OrderNormal is an Order of type Normal. OrderNormal Order = 30 // OrderBelowNormal is an Order of type BelowNormal. OrderBelowNormal Order = 40 )
func ParseOrder ¶
ParseOrder converts a string to an Order.
type Slice ¶
type Slice struct {
V []structure.ValueWrapper `"{" @@* "}"`
}
type TypedAnnotation ¶
type TypedAnnotation struct {
Type AnnotationType
Node ast.Node
Annotations *Annotations
Parent *TypedAnnotation
FileInfo *FileInfo
}
Click to show internal directories.
Click to hide internal directories.