er

package module
v0.0.0-...-869e079 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2019 License: GPL-3.0 Imports: 2 Imported by: 0

README

ER Modelling for Go

Entity-Relationship (ER) models are a powerful tool for designing software. They are based upon descriptive diagrams of real-world entities, possessing attributes and connected to one another by quantity relationships.

This repository maintains a collection of packages that are useful in manipulating a particular kind of ER model. What makes this approach unusual is that relationships can be annotated with constraints so that the logical-to-physical transformation is "right first time." The theoretical basis of this is elucidated on http://www.entitymodelling.org - what you find here is merely an alternative implementation of the same concepts.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidAttribute = errors.New("invalid attribute")
	ErrInvalidRecord    = errors.New("invalid record type")
	ErrMissingAttribute = errors.New("missing attribute")
	ErrDuplicateKey     = errors.New("duplicate key")
	ErrMissingEntity    = errors.New("entity not found by key")
	ErrImmutableSet     = errors.New("attempting to modify immutable set")
	ErrBadSyntax        = errors.New("syntax error")
)

ErrInvalidAttribute ...

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	Name        string        `rsf:"name"`
	Type        AttributeType `rsf:"type"`
	Identifying bool          `rsf:"identifying"`
	Owner       *EntityType
}

Attribute represents an attribute.

func (*Attribute) String

func (a *Attribute) String() string

type AttributeType

type AttributeType byte

AttributeType represents an attribute type.

const (
	InvalidType AttributeType = iota
	StringType
	IntType
	FloatType
)

Supported attribute types.

type Component

type Component struct {
	RelName string `rsf:"rel_name"`
	Rel     *Relationship
}

Component represents part of a path.

type Constraint

type Constraint struct {
	Diagonal Diagonal `rsf:"diagonal"`
	Riser    Riser    `rsf:"riser"`
}

Constraint represnts a constraint over a relationship.

type Diagonal

type Diagonal struct {
	Components []Component `rsf:"component"`
}

type EntityModel

type EntityModel struct {
	Name  string
	Types []*EntityType
}

EntityModel represents a collection of entity types and how they relate.

type EntityType

type EntityType struct {
	Name          string          `rsf:"name"`
	Attributes    []*Attribute    `rsf:"attribute"`
	Relationships []*Relationship `rsf:"relationship"`
	DependsOn     *Relationship
}

EntityType represents an entity type.

func (*EntityType) String

func (t *EntityType) String() string

type Implementation

type Implementation struct {
	Source, Target *Attribute
	BasePath       []Component
}

Implementation represents part of an attribute filter.

type Relationship

type Relationship struct {
	Name           string           `rsf:"name"`
	TargetName     string           `rsf:"type_name"`
	Constraints    []Constraint     `rsf:"constraint"`
	Identifying    bool             `rsf:"identifying"`
	Implementation []Implementation `rsf:"implementation"`
	Source, Target *EntityType
}

Relationship represents a relationship.

func (*Relationship) String

func (a *Relationship) String() string

type Riser

type Riser struct {
	Components []Component `rsf:"component"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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