Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrTooManyAnnotations is the error that is thrown when more than one annotation of the same type is declared. The struct will still be filled with the first declared annotation ErrTooManyAnnotations = errors.New("the annotation type was declared multiple times in the comment") // ErrNoAnnotation is the error that is thrown when no annotations were found in the comment ErrNoAnnotation = errors.New("the requested annotation type was not find in the comment") )
Functions ¶
This section is empty.
Types ¶
type Annotation ¶
type Annotation interface { // GetIdentifier returns the identifier of the annotation GetIdentifier() string }
Annotation is a basic interface all annotations have to follow, as they need to provide their identifier
type CsvParser ¶
type CsvParser struct { }
CsvParser is a csv implementation of the annotation parser. It will parse the annotation following a csv format, where the key,value pairs are separated by a ,
func NewCsvParser ¶
func NewCsvParser() *CsvParser
NewCsvParser creates a new parser with the default typ registry
type Parser ¶
type Parser interface {
Parse(comment string, annotation Annotation) error
}
Parser is an interface that is capable of parsing an annotation based on a string.
type PropertyParser ¶
type PropertyParser struct { }
PropertyParser is a csv implementation of the annotation parser. It will parse the annotation following a csv format, where the key, value pairs are separated by a,
func NewPropertyParser ¶
func NewPropertyParser() *PropertyParser
NewPropertyParser creates a new parser with the default typ registry
func (*PropertyParser) Parse ¶
func (p *PropertyParser) Parse(comment string, annotation Annotation) (e error)
Parse parses an annotation following the format of the PropertyParser