annotation

package
v1.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func (*CsvParser) Parse

func (c *CsvParser) Parse(comment string, annotation Annotation) (e error)

Parse parses an annotation following the format of the CsvParser

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL