Documentation ¶
Overview ¶
Package annotation hosts the general annotation framework used by pina-golada. In here, both the annotation interface as well as the default parser implementation are defined.
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 found 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 LabelParser ¶ added in v1.3.1
type LabelParser struct { }
LabelParser defines a go-style label parser implementation
func NewLabelParser ¶ added in v1.3.1
func NewLabelParser() *LabelParser
NewLabelParser creates a new instance of the label parser
func (*LabelParser) Parse ¶ added in v1.3.1
func (c *LabelParser) Parse(comment string, annotation Annotation) (e error)
Parse parses an annotation following the format of the LabelParser
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