binding

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

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

type Field struct {
	ModelProperty *model.Property
	Name          string
	Optional      string
	IsSkipped     bool
}

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 CreateField(prop *model.Property) *Field

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, ...)

func (*Field) SetName

func (field *Field) SetName(name string)

type Object

type Object struct {
	ModelEntity *model.Entity
	Name        string
	Namespace   string
	IsSkipped   bool
}

Object holds common entity information used by specialized code parsers/generators. Additionally, it groups some shared logic, e.g. annotation processing

func CreateObject

func CreateObject(entity *model.Entity) *Object

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, ...)

func (*Object) SetName

func (object *Object) SetName(name string)

Jump to

Keyboard shortcuts

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