beego bee tool mirror
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
448 B

package beeParser
import "encoding/json"
type AnnotationFormatter struct {
Annotation Annotator
}
func (f *AnnotationFormatter) Format(field *StructField) string {
if field.Comment == "" && field.Doc == "" {
return ""
}
kvs := f.Annotation.Annotate(field.Doc + field.Comment)
res, _ := json.Marshal(kvs)
return string(res)
}
func NewAnnotationFormatter() *AnnotationFormatter {
return &AnnotationFormatter{Annotation: &Annotation{}}
}