Documentation ¶
Index ¶
- func URLExampleData() string
- func URLModelsYML() string
- func URLPermission() string
- func Unmarshal(r io.Reader) (map[string]Model, error)
- type AttributeGenericRelation
- type AttributeRelation
- type AttributeTemplate
- type Field
- type Model
- type Relation
- type To
- type ToCollectionField
- type ToField
- type ToGeneric
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func URLExampleData ¶
func URLExampleData() string
URLExampleData returns the url to the example-data file.
func URLPermission ¶
func URLPermission() string
URLPermission returns the url to the example-data file.
Types ¶
type AttributeGenericRelation ¶
type AttributeGenericRelation struct { To ToGeneric `yaml:"to"` // contains filtered or unexported fields }
AttributeGenericRelation is a generic-relation or generic-relation-list field.
func (AttributeGenericRelation) List ¶
func (r AttributeGenericRelation) List() bool
List tells, if the object is a generic-relation-list.
func (AttributeGenericRelation) ToCollections ¶
func (r AttributeGenericRelation) ToCollections() []ToCollectionField
ToCollections returns all collection, where the generic field could point to.
type AttributeRelation ¶
type AttributeRelation struct { To To `yaml:"to"` // contains filtered or unexported fields }
AttributeRelation is a relation or relation-list field.
func (AttributeRelation) List ¶
func (r AttributeRelation) List() bool
List returns true, if object is an attribute-relation-list
func (AttributeRelation) ToCollections ¶
func (r AttributeRelation) ToCollections() []ToCollectionField
ToCollections returns the names of the collections there the attribute points to. It is allways a slice with one element.
type AttributeTemplate ¶
type AttributeTemplate struct { Replacement string `yaml:"replacement_collection"` Fields Field `yaml:"fields"` }
AttributeTemplate represents a template field.
type Field ¶
type Field struct { Type string Template *AttributeTemplate Required bool // contains filtered or unexported fields }
Field of a model.
func (*Field) Relation ¶
Relation returns the relation object if the Field is a relation or a template with a relation. In other cases, it returns nil.
func (*Field) RestrictionMode ¶
RestrictionMode returns the restriction mode the field belongs to.
func (*Field) UnmarshalYAML ¶
UnmarshalYAML decodes a model attribute from yaml.
type Model ¶
Model replresents one model from models.yml.
func (*Model) UnmarshalYAML ¶
UnmarshalYAML decodes a yaml model to models.Model.
type Relation ¶
type Relation interface { ToCollections() []ToCollectionField List() bool }
Relation represents some kind of relation between fields.
type To ¶
type To struct {
CollectionField ToCollectionField
}
To is shows a Relation where to point to.
func (*To) UnmarshalYAML ¶
UnmarshalYAML decodes the models.yml to a To object.
type ToCollectionField ¶
type ToCollectionField struct { Collection string `yaml:"collection"` ToField ToField `yaml:"field"` }
ToCollectionField represents a field and a collection
func (*ToCollectionField) UnmarshalYAML ¶
func (t *ToCollectionField) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML decodes the models.yml to a To object.
type ToField ¶
ToField is
func (*ToField) UnmarshalYAML ¶
UnmarshalYAML decodes the models.yml to a ToField object.
type ToGeneric ¶
type ToGeneric struct {
CollectionFields []ToCollectionField
}
ToGeneric is like a To object, but for generic relations.
func (*ToGeneric) UnmarshalYAML ¶
UnmarshalYAML unmarshalls data to a ToGeneric object.