Merge pull request #510 from alixander/update-sql-texts
update sql texts measure
This commit is contained in:
commit
ce6d5d7775
2 changed files with 19 additions and 14 deletions
|
|
@ -1084,7 +1084,9 @@ func (g *Graph) Texts() []*d2target.MText {
|
||||||
}
|
}
|
||||||
} else if obj.SQLTable != nil {
|
} else if obj.SQLTable != nil {
|
||||||
for _, column := range obj.SQLTable.Columns {
|
for _, column := range obj.SQLTable.Columns {
|
||||||
texts = appendTextDedup(texts, column.Text())
|
for _, t := range column.Texts() {
|
||||||
|
texts = appendTextDedup(texts, t)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,5 @@
|
||||||
package d2target
|
package d2target
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"oss.terrastruct.com/d2/d2renderers/d2fonts"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
NamePadding = 10
|
NamePadding = 10
|
||||||
TypePadding = 20
|
TypePadding = 20
|
||||||
|
|
@ -22,13 +16,22 @@ type SQLColumn struct {
|
||||||
Reference string `json:"reference"`
|
Reference string `json:"reference"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c SQLColumn) Text() *MText {
|
func (c SQLColumn) Texts() []*MText {
|
||||||
return &MText{
|
return []*MText{
|
||||||
Text: fmt.Sprintf("%s%s%s%s", c.Name.Label, c.Type.Label, c.Constraint, c.Reference),
|
{
|
||||||
FontSize: d2fonts.FONT_SIZE_L,
|
Text: c.Name.Label,
|
||||||
IsBold: false,
|
FontSize: c.Name.FontSize,
|
||||||
IsItalic: false,
|
IsBold: false,
|
||||||
Shape: "sql_table",
|
IsItalic: false,
|
||||||
|
Shape: "sql_table",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Text: c.Type.Label,
|
||||||
|
FontSize: c.Type.FontSize,
|
||||||
|
IsBold: false,
|
||||||
|
IsItalic: false,
|
||||||
|
Shape: "sql_table",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue