annotations

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearRegisteredAnnotations

func ClearRegisteredAnnotations()

func RegisterAnnotation

func RegisterAnnotation(name string, paramNames []string, validator ValidationFunc)

func RegisterAnnotationExt

func RegisterAnnotationExt(fullLine bool, name string, paramNames []string, validator ValidationFunc)

Odnotuj wspierająca anotacja do wlasnego parsowania (bez nawiasów) wymagane fullline=true @Anotacja

func RegisterAnnotationLine

func RegisterAnnotationLine(name string, paramNames []string, validator ValidationFunc)

Odnotuj wspierająca anotacja do wlasnego parsowania (bez nawiasów) wymagane fullline=true

func RegisterAnnotations

func RegisterAnnotations(ann ...AnnotationDescriptor)

Types

type Annotation

type Annotation struct {
	Name string
	// dla wsparcia anotacij bez nawiasow, tj
	// @Anotacja
	LineValue  string
	IsFullLine bool
	Param      string
	Attributes map[string]string
}

func (Annotation) IsFullLineWithContent

func (a Annotation) IsFullLineWithContent() bool

func (Annotation) IsSetAttribute

func (a Annotation) IsSetAttribute(name string) bool

type AnnotationDescriptor

type AnnotationDescriptor struct {
	FullLine bool

	// jeżeli full line to możemy także miec pola
	IsField   bool
	MinFields int
	MaxFields int

	Name       string
	ParamNames []string
	Validator  ValidationFunc
}

type AnnotationRegister

type AnnotationRegister interface {
	ResolveAnnotations(annotationDocline []string) []Annotation
	ResolveAnnotationByName(annotationDocline []string, name string) (Annotation, bool)
	ResolveAnnotation(annotationDocline string) (Annotation, bool)
	ResolveAllAnnotationByName(annotationDocline []string, name string) ([]Annotation, bool)
	ResolveFullLineAllAnnotationByName(annotationDocline []string, name string) ([]string, bool)
}

func NewGlobalRegistry

func NewGlobalRegistry() AnnotationRegister

func NewRegistry

func NewRegistry(descriptors []AnnotationDescriptor) AnnotationRegister

type ValidationFunc

type ValidationFunc func(annot Annotation) bool

func Ok

func Ok(name string) ValidationFunc

Jump to

Keyboard shortcuts

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