1
0
mirror of https://github.com/ManyakRus/image_database.git synced 2025-11-06 09:29:08 +02:00

сделал description

This commit is contained in:
Nikitin Aleksandr
2024-09-12 15:22:05 +03:00
parent b7f69a9e83
commit 5fda597911
6 changed files with 44 additions and 49 deletions

View File

@@ -77,7 +77,7 @@ func FillEntities(ElementInfoGraph types.ElementInfoStruct, MapAll *map[string]*
} }
TextAttributes = TextAttributes + column1.Name + " " + column1.Type TextAttributes = TextAttributes + column1.Name + " " + column1.Type
} }
ElementInfo1 := graphml.CreateElement_Entity(ElementInfoGraph, table1.Name, TextAttributes) ElementInfo1 := graphml.CreateElement_Entity(ElementInfoGraph, table1.Name, TextAttributes, table1.Comment)
table1.ElementInfo = ElementInfo1 table1.ElementInfo = ElementInfo1
} }

View File

@@ -16,6 +16,7 @@ import (
type TableColumn struct { type TableColumn struct {
TableName string `json:"table_name" gorm:"column:table_name;default:''"` TableName string `json:"table_name" gorm:"column:table_name;default:''"`
TableComment string `json:"table_comment" gorm:"column:table_comment;default:''"`
ColumnName string `json:"column_name" gorm:"column:column_name;default:''"` ColumnName string `json:"column_name" gorm:"column:column_name;default:''"`
ColumnType string `json:"type_name" gorm:"column:type_name;default:''"` ColumnType string `json:"type_name" gorm:"column:type_name;default:''"`
ColumnIsPrimaryKey string `json:"is_primary_key" gorm:"column:is_primary_key;default:''"` ColumnIsPrimaryKey string `json:"is_primary_key" gorm:"column:is_primary_key;default:''"`
@@ -97,19 +98,20 @@ SELECT
COALESCE(keys.column_to, '') as column_key COALESCE(keys.column_to, '') as column_key
FROM FROM
pg_catalog.pg_statio_all_tables as st information_schema.columns c
inner join left join
pg_catalog.pg_statio_all_tables as st
on
c.table_schema = st.schemaname
and c.table_name = st.relname
left join
pg_catalog.pg_description pgd pg_catalog.pg_description pgd
on on
pgd.objoid = st.relid pgd.objoid = st.relid
and pgd.objsubid = c.ordinal_position
right join
information_schema.columns c
on
pgd.objsubid = c.ordinal_position
and c.table_schema = st.schemaname
and c.table_name = st.relname
LEFT JOIN --внешние ключи LEFT JOIN --внешние ключи
@@ -230,6 +232,7 @@ order by
} }
Table1 = CreateTable() Table1 = CreateTable()
Table1.Name = v.TableName Table1.Name = v.TableName
Table1.Comment = v.TableComment
Table1.OrderNumber = OrderNumberTable Table1.OrderNumber = OrderNumberTable
} }

View File

@@ -15,7 +15,8 @@ type Column struct {
} }
type Table struct { type Table struct {
Name string `json:"name" gorm:"column:name;default:''"` Name string `json:"name" gorm:"column:name;default:''"`
Comment string
//Element *etree.Element //Element *etree.Element
ElementInfo ElementInfoStruct ElementInfo ElementInfoStruct
MapColumns map[string]Column MapColumns map[string]Column

View File

@@ -26,7 +26,7 @@ var FONT_SIZE_GROUP = 10
var FONT_SIZE_EDGE = 8 var FONT_SIZE_EDGE = 8
// CreateElement_Entity - создаёт элемент - Entity // CreateElement_Entity - создаёт элемент - Entity
func CreateElement_Entity(ElementInfoMain types.ElementInfoStruct, ElementName, ElementAttribute string) types.ElementInfoStruct { func CreateElement_Entity(ElementInfoMain types.ElementInfoStruct, ElementName, ElementAttribute, Description string) types.ElementInfoStruct {
Width := findWidth_Entity(ElementName + "\n" + ElementAttribute) Width := findWidth_Entity(ElementName + "\n" + ElementAttribute)
Height := findHeight_Entity(ElementName + ElementAttribute) Height := findHeight_Entity(ElementName + ElementAttribute)
@@ -62,6 +62,7 @@ func CreateElement_Entity(ElementInfoMain types.ElementInfoStruct, ElementName,
//data //data
ElementData := ElementNode.CreateElement("data") ElementData := ElementNode.CreateElement("data")
ElementData.CreateAttr("key", "d4") ElementData.CreateAttr("key", "d4")
ElementData.CreateCData(Description)
//data //data
ElementData2 := ElementNode.CreateElement("data") ElementData2 := ElementNode.CreateElement("data")

View File

@@ -9,8 +9,8 @@ func TestCreateNewGraphml(t *testing.T) {
dir := micro.ProgramDir() dir := micro.ProgramDir()
DocXML, ElementGraph := CreateDocument() DocXML, ElementGraph := CreateDocument()
Entity1 := CreateElement_Entity(ElementGraph, "Entity1", "Field1\nField2\nField3\n1234567890") Entity1 := CreateElement_Entity(ElementGraph, "Entity1", "Field1\nField2\nField3\n1234567890", "")
Entity2 := CreateElement_Entity(ElementGraph, "Entity2", "Field1\nField2\nField3\n1234567890") Entity2 := CreateElement_Entity(ElementGraph, "Entity2", "Field1\nField2\nField3\n1234567890", "")
CreateElement_Edge(ElementGraph, Entity1, Entity2, "edge1", "descr", 4, 1) CreateElement_Edge(ElementGraph, Entity1, Entity2, "edge1", "descr", 4, 1)
//Shape2 := CreateElement_Shape(ElementGraph, "Shape2") //Shape2 := CreateElement_Shape(ElementGraph, "Shape2")
//Group1 := CreateElement_Group(ElementGraph, "Group1") //Group1 := CreateElement_Group(ElementGraph, "Group1")

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd"> <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd">
<!--Created by yEd 3.23.2-->
<key for="port" id="d0" yfiles.type="portgraphics"/> <key for="port" id="d0" yfiles.type="portgraphics"/>
<key for="port" id="d1" yfiles.type="portgeometry"/> <key for="port" id="d1" yfiles.type="portgeometry"/>
<key for="port" id="d2" yfiles.type="portuserdata"/> <key for="port" id="d2" yfiles.type="portuserdata"/>
@@ -12,24 +13,18 @@
<key for="edge" id="d9" yfiles.type="edgegraphics"/> <key for="edge" id="d9" yfiles.type="edgegraphics"/>
<graph edgedefault="directed" id="G"> <graph edgedefault="directed" id="G">
<node id="n0"> <node id="n0">
<data key="d4"/> <data key="d4" xml:space="preserve"><![CDATA[Описание1]]></data>
<data key="d5"> <data key="d5">
<y:GenericNode configuration="com.yworks.entityRelationship.big_entity"> <y:GenericNode configuration="com.yworks.entityRelationship.big_entity">
<y:Geometry height="117.0" width="109.0" x="-270.0" y="-65.0"/> <y:Geometry height="117.0" width="109.0" x="-563.0" y="-65.0"/>
<y:Fill color="#E8EEF7" color2="#B7C9E3" transparent="false"/> <y:Fill color="#E8EEF7" color2="#B7C9E3" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/> <y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" backgroundColor="#B7C9E3" configuration="com.yworks.entityRelationship.label.name" fontFamily="Dialog" fontSize="16" fontStyle="plain" hasLineColor="false" height="117.0" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="109.0" x="16.0" xml:space="preserve" y="4.0">Entity1</y:NodeLabel> <y:NodeLabel alignment="center" autoSizePolicy="content" backgroundColor="#B7C9E3" configuration="com.yworks.entityRelationship.label.name" fontFamily="Dialog" fontSize="16" fontStyle="plain" hasLineColor="false" height="22.625" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="60.890625" x="24.0546875" xml:space="preserve" y="4.0">Entity1</y:NodeLabel>
<y:NodeLabel alignment="left" autoSizePolicy="content" configuration="com.yworks.entityRelationship.label.attributes" fontFamily="Dialog" fontSize="16" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="117.0" horizontalTextPosition="center" iconTextGap="4" modelName="free" modelPosition="anywhere" textColor="#000000" verticalTextPosition="top" visible="true" width="109.0" x="2.0" xml:space="preserve" y="30.0">Field1 <y:NodeLabel alignment="left" autoSizePolicy="content" configuration="com.yworks.entityRelationship.label.attributes" fontFamily="Dialog" fontSize="16" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="97.125" horizontalTextPosition="center" iconTextGap="4" modelName="free" modelPosition="anywhere" textColor="#000000" verticalTextPosition="top" visible="true" width="105.796875" x="2.0" xml:space="preserve" y="30.0">Field1
Field2 Field2
Field3 Field3
1234567890 1234567890
<y:LabelModel> </y:NodeLabel>
<y:ErdAttributesNodeLabelModel/>
</y:LabelModel>
<y:ModelParameter>
<y:ErdAttributesNodeLabelModelParameter/>
</y:ModelParameter>
</y:NodeLabel>
<y:StyleProperties> <y:StyleProperties>
<y:Property class="java.lang.Boolean" name="y.view.ShadowNodePainter.SHADOW_PAINTING" value="true"/> <y:Property class="java.lang.Boolean" name="y.view.ShadowNodePainter.SHADOW_PAINTING" value="true"/>
</y:StyleProperties> </y:StyleProperties>
@@ -37,43 +32,38 @@ Field3
</data> </data>
</node> </node>
<node id="n1"> <node id="n1">
<data key="d4"/>
<data key="d5"> <data key="d5">
<y:GenericNode configuration="com.yworks.entityRelationship.big_entity"> <y:GenericNode configuration="com.yworks.entityRelationship.big_entity">
<y:Geometry height="117.0" width="109.0" x="-270.0" y="-65.0"/> <y:Geometry height="117.0" width="109.0" x="-270.0" y="-65.0"/>
<y:Fill color="#E8EEF7" color2="#B7C9E3" transparent="false"/> <y:Fill color="#E8EEF7" color2="#B7C9E3" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/> <y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" backgroundColor="#B7C9E3" configuration="com.yworks.entityRelationship.label.name" fontFamily="Dialog" fontSize="16" fontStyle="plain" hasLineColor="false" height="117.0" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="109.0" x="16.0" xml:space="preserve" y="4.0">Entity2</y:NodeLabel> <y:NodeLabel alignment="center" autoSizePolicy="content" backgroundColor="#B7C9E3" configuration="com.yworks.entityRelationship.label.name" fontFamily="Dialog" fontSize="16" fontStyle="plain" hasLineColor="false" height="22.625" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="60.890625" x="24.0546875" xml:space="preserve" y="4.0">Entity2</y:NodeLabel>
<y:NodeLabel alignment="left" autoSizePolicy="content" configuration="com.yworks.entityRelationship.label.attributes" fontFamily="Dialog" fontSize="16" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="117.0" horizontalTextPosition="center" iconTextGap="4" modelName="free" modelPosition="anywhere" textColor="#000000" verticalTextPosition="top" visible="true" width="109.0" x="2.0" xml:space="preserve" y="30.0">Field1 <y:NodeLabel alignment="left" autoSizePolicy="content" configuration="com.yworks.entityRelationship.label.attributes" fontFamily="Dialog" fontSize="16" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="97.125" horizontalTextPosition="center" iconTextGap="4" modelName="free" modelPosition="anywhere" textColor="#000000" verticalTextPosition="top" visible="true" width="105.796875" x="2.0" xml:space="preserve" y="30.0">Field1
Field2 Field2
Field3 Field3
1234567890 1234567890
<y:LabelModel> </y:NodeLabel>
<y:ErdAttributesNodeLabelModel/>
</y:LabelModel>
<y:ModelParameter>
<y:ErdAttributesNodeLabelModelParameter/>
</y:ModelParameter>
</y:NodeLabel>
<y:StyleProperties> <y:StyleProperties>
<y:Property class="java.lang.Boolean" name="y.view.ShadowNodePainter.SHADOW_PAINTING" value="true"/> <y:Property class="java.lang.Boolean" name="y.view.ShadowNodePainter.SHADOW_PAINTING" value="true"/>
</y:StyleProperties> </y:StyleProperties>
</y:GenericNode> </y:GenericNode>
</data> </data>
</node> </node>
<edge id="e0" source="n0" target="n1">
<data key="d8" xml:space="preserve"><![CDATA[descr]]></data>
<data key="d9">
<y:PolyLineEdge>
<y:Path sx="-54.0" sy="39.1" tx="54.0" ty="-18.5"/>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="crows_foot_many" target="none"/>
<y:EdgeLabel alignment="center" bottomInset="0" configuration="AutoFlippingLabel" distance="0.0" fontFamily="Dialog" fontSize="8" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.625" horizontalTextPosition="center" iconTextGap="4" leftInset="0" modelName="centered" modelPosition="center" preferredPlacement="on_edge" ratio="0.5" rightInset="0" textColor="#000000" topInset="0" verticalTextPosition="bottom" visible="true" width="25.4296875" x="79.2625732421875" xml:space="preserve" y="-22.524218749999996">edge1
<y:PreferredPlacementDescriptor angle="0.0" angleOffsetOnRightSide="0" angleReference="absolute" angleRotationOnRightSide="co" distance="-1.0" placement="anywhere" side="on_edge" sideReference="relative_to_edge_flow"/></y:EdgeLabel>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
</graph> </graph>
<edge id="e11" source="n0" target="n1"> <data key="d6">
<data key="d8" xml:space="preserve"><![CDATA[descr]]></data> <y:Resources/>
<data key="d9"> </data>
<y:PolyLineEdge>
<y:Path sx="-54.0" sy="39.1" tx="54.0" ty="-18.5"/>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="crows_foot_many" target="none"/>
<y:EdgeLabel alignment="center" configuration="AutoFlippingLabel" distance="0.0" fontFamily="Dialog" fontSize="8" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="centered" modelPosition="head" preferredPlacement="anywhere" ratio="0.5" textColor="#000000" verticalTextPosition="bottom" visible="true" width="41.8" x="71.5" xml:space="preserve" y="0.5" bottomInset="0" leftInset="0" rightInset="0" topInset="0">edge1
<y:PreferredPlacementDescriptor angle="0.0" angleOffsetOnRightSide="0" angleReference="absolute" angleRotationOnRightSide="co" distance="-1.0" placement="anywhere" side="on_edge" sideReference="relative_to_edge_flow"/>
</y:EdgeLabel>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
</graphml> </graphml>