This commit is contained in:
hoteas 2017-08-23 01:40:54 +00:00
parent 043dc226dc
commit 6940609ad2
3 changed files with 277 additions and 82 deletions

307
.idea/workspace.xml generated
View File

@ -5,8 +5,9 @@
</component>
<component name="ChangeListManager">
<list default="true" readonly="true" id="03ed5703-81a1-441b-849c-c426276586b7" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/application.go" afterPath="$PROJECT_DIR$/application.go" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/context.go" afterPath="$PROJECT_DIR$/context.go" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/db.go" afterPath="$PROJECT_DIR$/db.go" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/example/main.go" afterPath="$PROJECT_DIR$/example/main.go" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
@ -17,23 +18,15 @@
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FileEditorManager">
<leaf>
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="application.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/application.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="142">
<state relative-caret-position="3332">
<caret line="206" column="10" lean-forward="false" selection-start-line="206" selection-start-column="10" selection-end-line="206" selection-end-column="10" />
<folding>
<marker date="1503369750531" expanded="true" signature="164:222" ph="{...}" />
<marker date="1503369750531" expanded="true" signature="5062:5989" ph="{...}" />
<marker date="1503369750531" expanded="true" signature="5088:5304" ph="{...}" />
<marker date="1503369750531" expanded="true" signature="5215:5300" ph="{...}" />
<marker date="1503369750531" expanded="true" signature="5393:5656" ph="{...}" />
<marker date="1503369750531" expanded="true" signature="5473:5585" ph="{...}" />
<marker date="1503369750531" expanded="true" signature="5549:5581" ph="{...}" />
<marker date="1503369750531" expanded="true" signature="5616:5653" ph="{...}" />
<marker date="1503369750531" expanded="true" signature="5691:5725" ph="{...}" />
<marker date="1503369750531" expanded="true" signature="5808:5900" ph="{...}" />
</folding>
</state>
</provider>
@ -42,16 +35,10 @@
<file leaf-file-name="context.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/context.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170">
<caret line="12" column="30" lean-forward="true" selection-start-line="12" selection-start-column="30" selection-end-line="12" selection-end-column="30" />
<state relative-caret-position="119">
<caret line="12" column="30" lean-forward="false" selection-start-line="12" selection-start-column="30" selection-end-line="12" selection-end-column="30" />
<folding>
<marker date="1503370865995" expanded="true" signature="880:935" ph="{...}" />
<marker date="1503370865995" expanded="true" signature="880:1005" ph="{...}" />
<marker date="1503370865995" expanded="true" signature="880:1081" ph="{...}" />
<marker date="1503370865995" expanded="true" signature="1011:1039" ph="{...}" />
<marker date="1503370865995" expanded="true" signature="1111:1262" ph="{...}" />
<marker date="1503370865995" expanded="true" signature="1138:1151" ph="{...}" />
<marker date="1503370865995" expanded="true" signature="1206:1219" ph="{...}" />
</folding>
</state>
</provider>
@ -60,7 +47,7 @@
<file leaf-file-name="server.go" pinned="false" current-in-tab="false">
<entry file="file://D:/app/go/src/net/http/server.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-49">
<state relative-caret-position="1122">
<caret line="89" column="5" lean-forward="false" selection-start-line="89" selection-start-column="5" selection-end-line="89" selection-end-column="5" />
<folding />
</state>
@ -80,15 +67,35 @@
<file leaf-file-name="main.go" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/example/main.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="34">
<caret line="2" column="7" lean-forward="true" selection-start-line="2" selection-start-column="7" selection-end-line="2" selection-end-column="7" />
<state relative-caret-position="362">
<caret line="51" column="0" lean-forward="true" selection-start-line="51" selection-start-column="0" selection-end-line="51" selection-end-column="0" />
<folding>
<element signature="e#14#101#0" expanded="true" />
<element signature="e#14#137#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="db.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/db.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="431">
<caret line="322" column="20" lean-forward="true" selection-start-line="322" selection-start-column="20" selection-end-line="322" selection-end-column="20" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="sql.go" pinned="false" current-in-tab="false">
<entry file="file://D:/app/go/src/database/sql/sql.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="6">
<caret line="1770" column="14" lean-forward="false" selection-start-line="1770" selection-start-column="14" selection-end-line="1770" selection-end-column="14" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
@ -115,7 +122,6 @@
<option value="$PROJECT_DIR$/Config.go" />
<option value="$PROJECT_DIR$/config.go" />
<option value="$PROJECT_DIR$/error.go" />
<option value="$PROJECT_DIR$/db.go" />
<option value="$PROJECT_DIR$/CacheMemory.go" />
<option value="$PROJECT_DIR$/cachememory.go" />
<option value="$PROJECT_DIR$/const.go" />
@ -129,8 +135,9 @@
<option value="$PROJECT_DIR$/func.go" />
<option value="$PROJECT_DIR$/var.go" />
<option value="$PROJECT_DIR$/example/tpt/index.html" />
<option value="$PROJECT_DIR$/example/main.go" />
<option value="$PROJECT_DIR$/application.go" />
<option value="$PROJECT_DIR$/db.go" />
<option value="$PROJECT_DIR$/example/main.go" />
</list>
</option>
</component>
@ -165,8 +172,168 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="Scratches" />
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="hotime" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="External Libraries" />
<option name="myItemType" value="com.jetbrains.php.config.library.PhpExternalLibrariesNodePatcher$PatchedExternalLibrariesNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="hotime" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="External Libraries" />
<option name="myItemType" value="com.jetbrains.php.config.library.PhpExternalLibrariesNodePatcher$PatchedExternalLibrariesNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="GOPATH &lt;hotime&gt;" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.NamedLibraryElementNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="hotime" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="External Libraries" />
<option name="myItemType" value="com.jetbrains.php.config.library.PhpExternalLibrariesNodePatcher$PatchedExternalLibrariesNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="GOPATH &lt;hotime&gt;" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.NamedLibraryElementNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="go.hoteas.com" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="hotime" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="hotime" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="External Libraries" />
<option name="myItemType" value="com.jetbrains.php.config.library.PhpExternalLibrariesNodePatcher$PatchedExternalLibrariesNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="GOPATH &lt;hotime&gt;" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.NamedLibraryElementNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="go.hoteas.com" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="hotime" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="example" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="hotime" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="External Libraries" />
<option name="myItemType" value="com.jetbrains.php.config.library.PhpExternalLibrariesNodePatcher$PatchedExternalLibrariesNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="GOPATH &lt;hotime&gt;" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.NamedLibraryElementNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="go.hoteas.com" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="hotime" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="example" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="tpt" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="hotime" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="External Libraries" />
<option name="myItemType" value="com.jetbrains.php.config.library.PhpExternalLibrariesNodePatcher$PatchedExternalLibrariesNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="GOPATH &lt;hotime&gt;" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.NamedLibraryElementNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="go.hoteas.com" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="hotime" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="example" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="config" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="hotime" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="External Libraries" />
<option name="myItemType" value="com.jetbrains.php.config.library.PhpExternalLibrariesNodePatcher$PatchedExternalLibrariesNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="GOPATH &lt;hotime&gt;" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.NamedLibraryElementNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="go.hoteas.com" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="hotime" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="config" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="hotime" />
@ -243,8 +410,6 @@
</PATH>
</subPane>
</pane>
<pane id="Scratches" />
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
@ -437,7 +602,8 @@
<workItem from="1502674761674" duration="3300000" />
<workItem from="1502760226287" duration="153000" />
<workItem from="1502935911308" duration="1724000" />
<workItem from="1503366689326" duration="1383000" />
<workItem from="1503366689326" duration="2378000" />
<workItem from="1503451223794" duration="1248000" />
</task>
<task id="LOCAL-00001">
<created>1500458878821</created>
@ -530,11 +696,18 @@
<option name="project" value="LOCAL" />
<updated>1503366743140</updated>
</task>
<option name="localTasksCounter" value="14" />
<task id="LOCAL-00014" summary="demo">
<created>1503393349195</created>
<option name="number" value="00014" />
<option name="presentableId" value="LOCAL-00014" />
<option name="project" value="LOCAL" />
<updated>1503393349195</updated>
</task>
<option name="localTasksCounter" value="15" />
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="57262000" />
<option name="totallyTimeSpent" value="59505000" />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
@ -547,13 +720,14 @@
</component>
<component name="ToolWindowManager">
<frame x="55" y="-8" width="1873" height="1096" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.30446774" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.30777717" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32846716" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.63343716" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32917964" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32917964" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.24972437" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32846716" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
@ -589,13 +763,6 @@
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/map.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="323">
<caret line="23" column="1" lean-forward="true" selection-start-line="23" selection-start-column="1" selection-end-line="23" selection-end-column="1" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/db.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
@ -806,7 +973,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170">
<caret line="13" column="0" lean-forward="true" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
@ -814,7 +980,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
@ -822,15 +987,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="187">
<caret line="11" column="22" lean-forward="false" selection-start-line="11" selection-start-column="22" selection-end-line="11" selection-end-column="22" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/db.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="11" column="5" lean-forward="false" selection-start-line="11" selection-start-column="5" selection-end-line="11" selection-end-column="5" />
<folding />
</state>
</provider>
</entry>
@ -846,7 +1002,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="903">
<caret line="136" column="1" lean-forward="false" selection-start-line="136" selection-start-column="1" selection-end-line="136" selection-end-column="1" />
<folding />
</state>
</provider>
</entry>
@ -868,7 +1023,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="102">
<caret line="6" column="0" lean-forward="false" selection-start-line="6" selection-start-column="0" selection-end-line="6" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
@ -886,7 +1040,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="799">
<caret line="48" column="0" lean-forward="false" selection-start-line="48" selection-start-column="0" selection-end-line="48" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
@ -894,7 +1047,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-83">
<caret line="17" column="67" lean-forward="false" selection-start-line="17" selection-start-column="67" selection-end-line="17" selection-end-column="67" />
<folding />
</state>
</provider>
</entry>
@ -902,7 +1054,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="597">
<caret line="305" column="0" lean-forward="false" selection-start-line="305" selection-start-column="0" selection-end-line="305" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
@ -922,42 +1073,28 @@
</entry>
<entry file="file://$PROJECT_DIR$/application.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="142">
<state relative-caret-position="3332">
<caret line="206" column="10" lean-forward="false" selection-start-line="206" selection-start-column="10" selection-end-line="206" selection-end-column="10" />
<folding>
<marker date="1503369750531" expanded="true" signature="164:222" ph="{...}" />
<marker date="1503369750531" expanded="true" signature="5062:5989" ph="{...}" />
<marker date="1503369750531" expanded="true" signature="5088:5304" ph="{...}" />
<marker date="1503369750531" expanded="true" signature="5215:5300" ph="{...}" />
<marker date="1503369750531" expanded="true" signature="5393:5656" ph="{...}" />
<marker date="1503369750531" expanded="true" signature="5473:5585" ph="{...}" />
<marker date="1503369750531" expanded="true" signature="5549:5581" ph="{...}" />
<marker date="1503369750531" expanded="true" signature="5616:5653" ph="{...}" />
<marker date="1503369750531" expanded="true" signature="5691:5725" ph="{...}" />
<marker date="1503369750531" expanded="true" signature="5808:5900" ph="{...}" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/context.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170">
<caret line="12" column="30" lean-forward="true" selection-start-line="12" selection-start-column="30" selection-end-line="12" selection-end-column="30" />
<state relative-caret-position="119">
<caret line="12" column="30" lean-forward="false" selection-start-line="12" selection-start-column="30" selection-end-line="12" selection-end-column="30" />
<folding>
<marker date="1503370865995" expanded="true" signature="880:935" ph="{...}" />
<marker date="1503370865995" expanded="true" signature="880:1005" ph="{...}" />
<marker date="1503370865995" expanded="true" signature="880:1081" ph="{...}" />
<marker date="1503370865995" expanded="true" signature="1011:1039" ph="{...}" />
<marker date="1503370865995" expanded="true" signature="1111:1262" ph="{...}" />
<marker date="1503370865995" expanded="true" signature="1138:1151" ph="{...}" />
<marker date="1503370865995" expanded="true" signature="1206:1219" ph="{...}" />
</folding>
</state>
</provider>
</entry>
<entry file="file://D:/app/go/src/net/http/server.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-49">
<state relative-caret-position="1122">
<caret line="89" column="5" lean-forward="false" selection-start-line="89" selection-start-column="5" selection-end-line="89" selection-end-column="5" />
<folding />
</state>
@ -971,12 +1108,28 @@
</state>
</provider>
</entry>
<entry file="file://D:/app/go/src/database/sql/sql.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="6">
<caret line="1770" column="14" lean-forward="false" selection-start-line="1770" selection-start-column="14" selection-end-line="1770" selection-end-column="14" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/db.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="431">
<caret line="322" column="20" lean-forward="true" selection-start-line="322" selection-start-column="20" selection-end-line="322" selection-end-column="20" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/main.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="34">
<caret line="2" column="7" lean-forward="true" selection-start-line="2" selection-start-column="7" selection-end-line="2" selection-end-column="7" />
<state relative-caret-position="362">
<caret line="51" column="0" lean-forward="true" selection-start-line="51" selection-start-column="0" selection-end-line="51" selection-end-column="0" />
<folding>
<element signature="e#14#101#0" expanded="true" />
<element signature="e#14#137#0" expanded="true" />
</folding>
</state>
</provider>

44
db.go
View File

@ -18,6 +18,8 @@ type HoTimeDB struct {
ConnectFunc func(err ...*Error) *sql.DB
//LastErr Error
limit Slice
Tx *sql.Tx //事务对象
}
//设置数据库配置连接
@ -26,6 +28,28 @@ func (this *HoTimeDB) SetConnect(connect func(err ...*Error) *sql.DB, err ...*Er
this.InitDb()
}
//事务如果action返回true则执行成功false则回滚
func (this *HoTimeDB) Action(action func() bool) Error {
tx, err := this.DB.Begin()
if err != nil {
this.LastErr.SetError(err)
return this.LastErr
}
this.Tx = tx
result := action()
if !result {
this.Tx.Rollback()
this.Tx = nil
return nil
}
this.Tx.Commit()
this.Tx = nil
return nil
}
func (this *HoTimeDB) InitDb(err ...*Error) Error {
if len(err) != 0 {
this.LastErr = *(err[0])
@ -258,7 +282,14 @@ func (this *HoTimeDB) Query(query string, args ...interface{}) []Map {
this.LastErr.SetError(err)
return nil
}
resl, err = this.DB.Query(query, args...)
if this.Tx!=nil{
resl, err = this.Tx.Query(query, args...)
}else{
resl, err = this.DB.Query(query, args...)
}
this.LastErr.SetError(err)
if err != nil {
if err = this.DB.Ping(); err != nil {
@ -279,13 +310,22 @@ func (this *HoTimeDB) Exec(query string, args ...interface{}) (sql.Result, Error
this.LastQuery = query
this.LastData = args
var e error
var resl sql.Result
if this.DB == nil {
err := errors.New("没有初始化数据库")
this.LastErr.SetError(err)
return nil, this.LastErr
}
resl, e := this.DB.Exec(query, args...)
if this.Tx!=nil{
resl, e = this.Tx.Exec(query, args...)
}else{
resl, e = this.DB.Exec(query, args...)
}
this.LastErr.SetError(e)

View File

@ -3,6 +3,7 @@ package main
import (
"database/sql"
"fmt"
_ "github.com/go-sql-driver/mysql"
"go.hoteas.com/hotime"
"golang.org/x/net/websocket"
)
@ -48,11 +49,12 @@ func main() {
"app": hotime.Proj{
"index": hotime.Ctr{
"test": func(this *hotime.Context) {
this.Display(0, "chenggong")
},
"websocket": func(this *hotime.Context) {
hdler:=websocket.Handler(func(ws *websocket.Conn) {
for true {
hdler := websocket.Handler(func(ws *websocket.Conn) {
for true {
msg := make([]byte, 5120)
n, err := ws.Read(msg)
@ -69,7 +71,7 @@ func main() {
fmt.Printf("Send: %s\n", msg[:m])
}
})
hdler.ServeHTTP(this.Resp,this.Req)
hdler.ServeHTTP(this.Resp, this.Req)
},
},
},