go20/day04/struct/json.drawio

123 lines
12 KiB
Plaintext
Raw Permalink Normal View History

<mxfile host="65bd71144e">
<diagram id="5nK-vBOAah09B86iugSh" name="第 1 页">
<mxGraphModel dx="1134" dy="435" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="3" value="obj" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="80" y="230" width="120" height="80" as="geometry"/>
</mxCell>
<mxCell id="4" value="" style="shape=flexArrow;endArrow=classic;html=1;" edge="1" parent="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="254" y="269.5" as="sourcePoint"/>
<mxPoint x="514" y="269.5" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="5" value="编码规则:&lt;div&gt;json&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="354" y="210" width="60" height="30" as="geometry"/>
</mxCell>
<mxCell id="7" value="bytes数组:&lt;div&gt;010101010&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="580" y="240" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="8" value="" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="580" y="370" width="120" height="80" as="geometry"/>
</mxCell>
<mxCell id="9" value="bytes数组:&lt;div&gt;010101010&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="580" y="510" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="10" value="网线0101" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="720" y="395" width="60" height="30" as="geometry"/>
</mxCell>
<mxCell id="11" value="" style="shape=flexArrow;endArrow=classic;html=1;" edge="1" parent="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="550" y="540" as="sourcePoint"/>
<mxPoint x="220" y="540" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="12" value="obj" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="80" y="490" width="120" height="80" as="geometry"/>
</mxCell>
<mxCell id="13" value="编码规则:&lt;div&gt;json&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="360" y="490" width="60" height="30" as="geometry"/>
</mxCell>
<mxCell id="14" value="序列化" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="354" y="280" width="60" height="30" as="geometry"/>
</mxCell>
<mxCell id="15" value="反序列" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="360" y="555" width="60" height="30" as="geometry"/>
</mxCell>
<mxCell id="16" value="Actor" style="shape=umlActor;verticalLabelPosition=bottom;verticalAlign=top;html=1;outlineConnect=0;" vertex="1" parent="1">
<mxGeometry x="340" y="70" width="30" height="60" as="geometry"/>
</mxCell>
<mxCell id="17" value="字符串" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="580" y="80" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="18" value="" style="shape=flexArrow;endArrow=classic;html=1;" edge="1" parent="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="640" y="220" as="sourcePoint"/>
<mxPoint x="640" y="160" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="19" value="字符解码" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="680" y="180" width="60" height="30" as="geometry"/>
</mxCell>
<mxCell id="20" value="unicode&lt;div&gt;&lt;div&gt;utf-8&amp;nbsp;&lt;/div&gt;&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="560" y="180" width="60" height="40" as="geometry"/>
</mxCell>
<mxCell id="21" value="" style="shape=flexArrow;endArrow=classic;html=1;" edge="1" parent="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="430" y="120" as="sourcePoint"/>
<mxPoint x="560" y="120" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="22" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="100" y="720" width="120" height="250" as="geometry"/>
</mxCell>
<mxCell id="23" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="350" y="720" width="120" height="250" as="geometry"/>
</mxCell>
<mxCell id="24" value="堆: Heap&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;灵活(复杂)&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="384" y="660" width="60" height="50" as="geometry"/>
</mxCell>
<mxCell id="25" value="栈 Stack&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;高效(基础值)&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="120" y="660" width="80" height="50" as="geometry"/>
</mxCell>
<mxCell id="26" value="fn a" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="100" y="920" width="120" height="30" as="geometry"/>
</mxCell>
<mxCell id="27" value="fn b" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="100" y="890" width="120" height="30" as="geometry"/>
</mxCell>
<mxCell id="34" style="edgeStyle=none;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="28" target="30">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="35" value="变量提升" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="34">
<mxGeometry x="0.1077" y="-3" relative="1" as="geometry">
<mxPoint as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="28" value="fn c (数据 v)" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="100" y="860" width="120" height="30" as="geometry"/>
</mxCell>
<mxCell id="29" value="&lt;pre style=&quot;box-sizing: border-box; overflow: auto; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 16px; overflow-wrap: normal; padding: 16px; line-height: 1.45; background-color: rgb(246, 248, 250); border-radius: 3px; min-height: 52px; tab-size: 4; color: rgb(64, 72, 91); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;&lt;code class=&quot;hljs hljs-go&quot; style=&quot;box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace; display: inline; overflow: visible; padding: 0px; color: rgba(0, 0, 0, 0.8); background: transparent; text-size-adjust: none; font-size: 14px; margin: 0px; border-radius: 6px; border: 0px; white-space: pre; font-weight: normal; word-break: normal; line-height: inherit; overflow-wrap: normal;&quot;&gt;&lt;span class=&quot;hljs-function&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; color: rgb(51, 51, 51); font-weight: bold;&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;hljs-title&quot; style=&quot;box-sizing: border-box; color: rgb(153, 0, 0); font-weight: bold;&quot;&gt;getPtr&lt;/span&gt;&lt;span class=&quot;hljs-params&quot; style=&quot;box-sizing: border-box;&quot;&gt;()&lt;/span&gt; *&lt;span class=&quot;hljs-title&quot; style=&quot;box-sizing: border-box; color: rgb(153, 0, 0); font-weight: bold;&quot;&gt;int&lt;/span&gt;&lt;/span&gt; {&#xa; v := &lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: rgb(0, 128, 128);&quot;&gt;10&lt;/span&gt;&#xa; &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; color: rgb(51, 51, 51); font-weight: bold;&quot;&gt;return&lt;/span&gt; &amp;amp;v &lt;span class=&quot;hljs-comment&quot; style=&quot;box-sizing: border-box; color: rgb(153, 153, 136); font-style: italic;&quot;&gt;// v 虽然是局部变量,但 Go 会自动提升到堆&lt;/span&gt;&#xa;}&lt;/code&gt;&lt;/pre&gt;" style="text;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="40" y="990" width="490" height="150" as="geometry"/>
</mxCell>
<mxCell id="30" value="v" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="350" y="860" width="120" height="30" as="geometry"/>
</mxCell>
<mxCell id="36" style="edgeStyle=none;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.25;entryDx=0;entryDy=0;" edge="1" parent="1" source="31" target="30">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="31" value="ptr" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="100" y="800" width="120" height="30" as="geometry"/>
</mxCell>
<mxCell id="33" style="edgeStyle=none;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="32" target="31">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="32" value="struct" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="350" y="780" width="120" height="30" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>