Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasBooleanDetail ¶ added in v0.12.0
func HasBooleanDetail(annotations map[string]*Annotation, parentAnnotation, name string) (bool, error)
HasBooleanDetail checks an annotation in the given map if it has a "Detail" with an empty value.
func ParseAnnotations ¶ added in v0.12.0
func ParseAnnotations(str string, annotations *map[string]*Annotation, supportedAnnotations map[string]bool) error
ParseAnnotations parses annotations in any of the following formats. name="name",index - creates two annotations, name and index, the former having a non-empty value relation(name=manyToManyRelName,to=TargetEntity) - creates a single annotation relation with two items as details id - creates a single annotation NOTE: this started as a very simple parser but it seems like the requirements are ever-increasing... maybe some form
of recursive tokenization would be better in case we decided to rework.
Types ¶
type Annotation ¶
type Annotation struct { Value string // Details is used to map complex annotations, e.g. many-to-many with brackets syntax, sync annotation. // e.g. relation(name=manyToManyRelName,to=TargetEntity) Details map[string]*Annotation }
Annotation is a tag on a struct-field
func (Annotation) HasDetail ¶ added in v0.12.0
func (a Annotation) HasDetail(name string) bool
HasDetail checks if the annotation has a "Detail" with the given name.
type Field ¶
Field holds common field/property information used by specialized code parsers/generators. Additionally, it groups some shared logic, e.g. annotation processing
func CreateField ¶
func (*Field) PreProcessAnnotations ¶
func (field *Field) PreProcessAnnotations(a map[string]*Annotation) error
func (*Field) ProcessAnnotations ¶
func (field *Field) ProcessAnnotations(a map[string]*Annotation) error
ProcessAnnotations checks all set annotations for any inconsistencies and sets local/property fields (flags, name, ...)
type Object ¶
Object holds common entity information used by specialized code parsers/generators. Additionally, it groups some shared logic, e.g. annotation processing
func CreateObject ¶
func (*Object) AddRelation ¶ added in v0.10.0
func (object *Object) AddRelation(details map[string]*Annotation) (*model.StandaloneRelation, error)
func (*Object) ProcessAnnotations ¶
func (object *Object) ProcessAnnotations(a map[string]*Annotation) error
ProcessAnnotations checks all set annotations for any inconsistencies and sets local/entity properties (uid, name, ...)