Documentation ¶
Overview ¶
Package er is mermaid entity relationship diagram builder.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attribute ¶
type Attribute struct { // Type is the type of the attribute. Type string // Name is the name of the attribute. Name string // IsPrimaryKey is the flag that indicates whether the attribute is a primary key. IsPrimaryKey bool // IsForeignKey is the flag that indicates whether the attribute is a foreign key. IsForeignKey bool // IsUniqueKey is the flag that indicates whether the attribute is a unique key. IsUniqueKey bool // Comment is the comment of the attribute. Comment string }
Attribute is a attribute of the entity.
type Diagram ¶
type Diagram struct {
// contains filtered or unexported fields
}
Diagram is a entity relationship diagram builder.
func NewDiagram ¶
NewDiagram returns a new Diagram.
func (*Diagram) NoRelationship ¶
NoRelationship adds an entity that has no relationships.
func (*Diagram) Relationship ¶
func (d *Diagram) Relationship(leftE, rightE Entity, leftR, rightR Relationship, identidy Identify, comment string) *Diagram
Relationship is a relationship of entity relationship. leftE: left entity rightE: right entity leftR: left relationship. You choice from Relationship constants (e.g. ZeroToOneRelationship) rightR: right relationship. You choice from Relationship constants (e.g. ZeroToOneRelationship) identidy: identify of the relationship. You choice from Identify constants (e.g. Identifying)
type Entity ¶
type Entity struct { // Name is the name of the entity. Name string // Attributes is the attributes of the entity. Attributes []*Attribute }
Entity is a entity of entity relationship.
type Identify ¶
type Identify bool
Identify is a type that represents the relationship between entities in an entity relationship diagram. Relationships may be classified as either identifying or non-identifying and these are rendered with either solid or dashed lines respectively.
const ( // Identifying is a constant that represents an identifying relationship. // It represents "--" in the entity relationship diagram. Identifying Identify = true // NonIdentifying is a constant that represents a non-identifying relationship. // It represents ".." in the entity relationship diagram. NonIdentifying Identify = false )
type Relationship ¶
type Relationship string
Relationship is a type that represents the relationship between entities.
const ( // ZeroToOneRelationship is a constant that represents a zero to one relationship. // e.g. "|o" or "o|" ZeroToOneRelationship Relationship = "zero_to_one" // ExactlyOneRelationship is a constant that represents an exactly one relationship. // e.g. "||" ExactlyOneRelationship Relationship = "exactly_one" // ZeroToMoreRelationship is a constant that represents a zero to more relationship. // e.g. "}o" or "o{}" ZeroToMoreRelationship Relationship = "zero_to_more" // OneToMoreRelationship is a constant that represents a one to more relationship. // e.g. "}|" or "|}" OneToMoreRelationship Relationship = "one_to_more" )