This commit is contained in:
hoteas 2017-08-22 01:42:22 +00:00
parent dde3586db4
commit 8920e9aaf4
2 changed files with 198 additions and 490 deletions

View File

@ -16,121 +16,13 @@
</component> </component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" /> <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> <leaf SIDE_TABS_SIZE_LIMIT_KEY="300" />
<file leaf-file-name="objtoobj.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/objtoobj.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="306">
<caret line="22" column="42" lean-forward="false" selection-start-line="22" selection-start-column="42" selection-end-line="22" selection-end-column="42" />
<folding>
<element signature="e#16#64#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="session.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/session.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="289">
<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>
</file>
<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="238">
<caret line="19" column="12" lean-forward="false" selection-start-line="19" selection-start-column="12" selection-end-line="19" selection-end-column="12" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="error.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/error.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="391">
<caret line="23" column="38" lean-forward="false" selection-start-line="23" selection-start-column="38" selection-end-line="23" selection-end-column="38" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="app.go" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/app.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="476">
<caret line="28" column="6" lean-forward="false" selection-start-line="28" selection-start-column="6" selection-end-line="28" selection-end-column="6" />
<folding>
<element signature="e#16#138#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="func.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/func.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2992">
<caret line="185" column="0" lean-forward="false" selection-start-line="185" selection-start-column="0" selection-end-line="185" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="var.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/var.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="204">
<caret line="12" column="28" lean-forward="false" selection-start-line="12" selection-start-column="28" selection-end-line="12" selection-end-column="28" />
<folding>
<marker date="1502249321786" expanded="true" signature="813:821" ph="{...}" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="obj.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/obj.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="952">
<caret line="56" column="0" lean-forward="false" selection-start-line="56" selection-start-column="0" selection-end-line="56" selection-end-column="0" />
<folding>
<marker date="1502075126746" expanded="true" signature="176:190" ph="{...}" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="map.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/map.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2244">
<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>
</file>
<file leaf-file-name="type.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/type.go">
<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>
</file>
</leaf>
</component> </component>
<component name="FileTemplateManagerImpl"> <component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES"> <option name="RECENT_TEMPLATES">
<list> <list>
<option value="Go File" /> <option value="Go File" />
<option value="HTML File" />
</list> </list>
</option> </option>
</component> </component>
@ -153,7 +45,6 @@
<option value="$PROJECT_DIR$/db.go" /> <option value="$PROJECT_DIR$/db.go" />
<option value="$PROJECT_DIR$/CacheMemory.go" /> <option value="$PROJECT_DIR$/CacheMemory.go" />
<option value="$PROJECT_DIR$/cachememory.go" /> <option value="$PROJECT_DIR$/cachememory.go" />
<option value="$PROJECT_DIR$/context.go" />
<option value="$PROJECT_DIR$/const.go" /> <option value="$PROJECT_DIR$/const.go" />
<option value="$PROJECT_DIR$/memorycache.go" /> <option value="$PROJECT_DIR$/memorycache.go" />
<option value="$PROJECT_DIR$/dbcache.go" /> <option value="$PROJECT_DIR$/dbcache.go" />
@ -161,8 +52,11 @@
<option value="$PROJECT_DIR$/session.go" /> <option value="$PROJECT_DIR$/session.go" />
<option value="$PROJECT_DIR$/type.go" /> <option value="$PROJECT_DIR$/type.go" />
<option value="$PROJECT_DIR$/app.go" /> <option value="$PROJECT_DIR$/app.go" />
<option value="$PROJECT_DIR$/var.go" /> <option value="$PROJECT_DIR$/context.go" />
<option value="$PROJECT_DIR$/func.go" /> <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" />
</list> </list>
</option> </option>
</component> </component>
@ -177,8 +71,8 @@
</component> </component>
<component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" /> <component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
<component name="ProjectFrameBounds"> <component name="ProjectFrameBounds">
<option name="x" value="55" /> <option name="x" value="-492" />
<option name="y" value="-8" /> <option name="y" value="376" />
<option name="width" value="1873" /> <option name="width" value="1873" />
<option name="height" value="1092" /> <option name="height" value="1092" />
</component> </component>
@ -197,6 +91,7 @@
<foldersAlwaysOnTop value="true" /> <foldersAlwaysOnTop value="true" />
</navigator> </navigator>
<panes> <panes>
<pane id="Scope" />
<pane id="ProjectPane"> <pane id="ProjectPane">
<subPane> <subPane>
<PATH> <PATH>
@ -209,9 +104,58 @@
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" /> <option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT> </PATH_ELEMENT>
</PATH> </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="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="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="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>
</subPane> </subPane>
</pane> </pane>
<pane id="Scope" />
<pane id="Scratches" /> <pane id="Scratches" />
</panes> </panes>
</component> </component>
@ -224,8 +168,12 @@
<property name="configurable.Module.GOPATH.is.expanded" value="false" /> <property name="configurable.Module.GOPATH.is.expanded" value="false" />
<property name="GO_FMT" value="false" /> <property name="GO_FMT" value="false" />
<property name="DefaultGoTemplateProperty" value="Go File" /> <property name="DefaultGoTemplateProperty" value="Go File" />
<property name="DefaultHtmlFileTemplate" value="HTML File" />
</component> </component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="E:\gopath1\trunk\src\go.hoteas.com\hotime\example" />
</key>
<key name="CopyFile.RECENT_KEYS"> <key name="CopyFile.RECENT_KEYS">
<recent name="D:\golang\path\trunk\src\hoteas\hotime" /> <recent name="D:\golang\path\trunk\src\hoteas\hotime" />
</key> </key>
@ -242,7 +190,16 @@
</list> </list>
</option> </option>
</component> </component>
<component name="RunManager"> <component name="RunManager" selected="Go Application.Build main.go and run">
<configuration default="false" name="Build main.go and run" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true">
<module name="hotime" />
<working_directory value="$PROJECT_DIR$/" />
<go_parameters value="-i" />
<filePath value="$PROJECT_DIR$/example/main.go" />
<kind value="FILE" />
<package value="hoteas/hotime" />
<method />
</configuration>
<configuration default="true" type="CodeceptionConfigurationType" factoryName="Codeception"> <configuration default="true" type="CodeceptionConfigurationType" factoryName="Codeception">
<PhpTestRunnerSettings /> <PhpTestRunnerSettings />
<method /> <method />
@ -334,6 +291,14 @@
<recursive>false</recursive> <recursive>false</recursive>
<method /> <method />
</configuration> </configuration>
<list size="1">
<item index="0" class="java.lang.String" itemvalue="Go Application.Build main.go and run" />
</list>
<recent_temporary>
<list size="1">
<item index="0" class="java.lang.String" itemvalue="Go Application.Build main.go and run" />
</list>
</recent_temporary>
</component> </component>
<component name="ShelveChangesManager" show_recycled="false"> <component name="ShelveChangesManager" show_recycled="false">
<option name="remove_strategy" value="false" /> <option name="remove_strategy" value="false" />
@ -383,6 +348,7 @@
<workItem from="1502445372160" duration="382000" /> <workItem from="1502445372160" duration="382000" />
<workItem from="1502674761674" duration="3300000" /> <workItem from="1502674761674" duration="3300000" />
<workItem from="1502760226287" duration="153000" /> <workItem from="1502760226287" duration="153000" />
<workItem from="1502935911308" duration="1724000" />
</task> </task>
<task id="LOCAL-00001"> <task id="LOCAL-00001">
<created>1500458878821</created> <created>1500458878821</created>
@ -447,11 +413,32 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1502360110313</updated> <updated>1502360110313</updated>
</task> </task>
<option name="localTasksCounter" value="10" /> <task id="LOCAL-00010" summary="框架基本完成">
<created>1502936078634</created>
<option name="number" value="00010" />
<option name="presentableId" value="LOCAL-00010" />
<option name="project" value="LOCAL" />
<updated>1502936078634</updated>
</task>
<task id="LOCAL-00011" summary="框架基本完成">
<created>1502936115199</created>
<option name="number" value="00011" />
<option name="presentableId" value="LOCAL-00011" />
<option name="project" value="LOCAL" />
<updated>1502936115199</updated>
</task>
<task id="LOCAL-00012" summary="demo">
<created>1502937437340</created>
<option name="number" value="00012" />
<option name="presentableId" value="LOCAL-00012" />
<option name="project" value="LOCAL" />
<updated>1502937437340</updated>
</task>
<option name="localTasksCounter" value="13" />
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="54155000" /> <option name="totallyTimeSpent" value="55879000" />
</component> </component>
<component name="TodoView"> <component name="TodoView">
<todo-panel id="selected-file"> <todo-panel id="selected-file">
@ -463,18 +450,18 @@
</todo-panel> </todo-panel>
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="55" y="-8" width="1873" height="1092" extended-state="0" /> <frame x="-492" y="376" width="1873" height="1092" extended-state="0" />
<layout> <layout>
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.29784888" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3011583" 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="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="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="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="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="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="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="false" show_stripe_button="true" weight="0.3295099" 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="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="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" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" 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" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" /> <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Messages" 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="false" content_ui="tabs" /> <window_info id="Messages" 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="false" content_ui="tabs" />
<window_info id="Message" 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="0" side_tool="false" content_ui="tabs" /> <window_info id="Message" 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="0" side_tool="false" content_ui="tabs" />
@ -496,7 +483,8 @@
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="框架基本完成" /> <MESSAGE value="框架基本完成" />
<option name="LAST_COMMIT_MESSAGE" value="框架基本完成" /> <MESSAGE value="demo" />
<option name="LAST_COMMIT_MESSAGE" value="demo" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>
@ -505,58 +493,6 @@
<watches-manager /> <watches-manager />
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/var.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170">
<caret line="10" column="9" lean-forward="false" selection-start-line="10" selection-start-column="9" selection-end-line="10" selection-end-column="9" />
<folding>
<marker date="1502249321786" expanded="true" signature="813:821" ph="{...}" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/map.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="544">
<caret line="32" column="21" lean-forward="false" selection-start-line="32" selection-start-column="21" selection-end-line="32" selection-end-column="21" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/db.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
<caret line="1" column="2" lean-forward="false" selection-start-line="1" selection-start-column="2" selection-end-line="1" selection-end-column="2" />
<folding>
<element signature="e#16#97#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/objtoobj.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1564">
<caret line="97" column="5" lean-forward="true" selection-start-line="97" selection-start-column="5" selection-end-line="97" selection-end-column="5" />
<folding>
<element signature="e#16#64#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/error.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="15" column="0" lean-forward="true" selection-start-line="15" selection-start-column="0" selection-end-line="15" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/slice.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1156">
<caret line="69" column="0" lean-forward="false" selection-start-line="69" selection-start-column="0" selection-end-line="69" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/func.go"> <entry file="file://$PROJECT_DIR$/func.go">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="595"> <state relative-caret-position="595">
@ -569,7 +505,7 @@
<state relative-caret-position="408"> <state relative-caret-position="408">
<caret line="24" column="2" lean-forward="true" selection-start-line="24" selection-start-column="2" selection-end-line="24" selection-end-column="2" /> <caret line="24" column="2" lean-forward="true" selection-start-line="24" selection-start-column="2" selection-end-line="24" selection-end-column="2" />
<folding> <folding>
<marker date="1502249321786" expanded="true" signature="813:821" ph="{...}" /> <marker date="1502936006492" expanded="true" signature="821:829" ph="{...}" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -585,9 +521,7 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17"> <state relative-caret-position="17">
<caret line="1" column="2" lean-forward="true" selection-start-line="1" selection-start-column="2" selection-end-line="1" selection-end-column="2" /> <caret line="1" column="2" lean-forward="true" selection-start-line="1" selection-start-column="2" selection-end-line="1" selection-end-column="2" />
<folding> <folding />
<element signature="e#16#97#0" expanded="false" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
@ -628,7 +562,7 @@
<state relative-caret-position="391"> <state relative-caret-position="391">
<caret line="23" column="2" lean-forward="true" selection-start-line="23" selection-start-column="2" selection-end-line="23" selection-end-column="2" /> <caret line="23" column="2" lean-forward="true" selection-start-line="23" selection-start-column="2" selection-end-line="23" selection-end-column="2" />
<folding> <folding>
<marker date="1502249321786" expanded="true" signature="813:821" ph="{...}" /> <marker date="1502936006492" expanded="true" signature="821:829" ph="{...}" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -644,9 +578,7 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17"> <state relative-caret-position="17">
<caret line="1" column="2" lean-forward="true" selection-start-line="1" selection-start-column="2" selection-end-line="1" selection-end-column="2" /> <caret line="1" column="2" lean-forward="true" selection-start-line="1" selection-start-column="2" selection-end-line="1" selection-end-column="2" />
<folding> <folding />
<element signature="e#16#97#0" expanded="false" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
@ -677,7 +609,7 @@
<state relative-caret-position="170"> <state relative-caret-position="170">
<caret line="15" column="2" lean-forward="true" selection-start-line="15" selection-start-column="2" selection-end-line="15" selection-end-column="2" /> <caret line="15" column="2" lean-forward="true" selection-start-line="15" selection-start-column="2" selection-end-line="15" selection-end-column="2" />
<folding> <folding>
<marker date="1502249321786" expanded="true" signature="813:821" ph="{...}" /> <marker date="1502936006492" expanded="true" signature="821:829" ph="{...}" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -696,9 +628,7 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-289"> <state relative-caret-position="-289">
<caret line="1" column="2" lean-forward="true" selection-start-line="1" selection-start-column="2" selection-end-line="1" selection-end-column="2" /> <caret line="1" column="2" lean-forward="true" selection-start-line="1" selection-start-column="2" selection-end-line="1" selection-end-column="2" />
<folding> <folding />
<element signature="e#16#97#0" expanded="false" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
@ -732,7 +662,7 @@
<state relative-caret-position="391"> <state relative-caret-position="391">
<caret line="23" column="46" lean-forward="true" selection-start-line="23" selection-start-column="46" selection-end-line="23" selection-end-column="46" /> <caret line="23" column="46" lean-forward="true" selection-start-line="23" selection-start-column="46" selection-end-line="23" selection-end-column="46" />
<folding> <folding>
<marker date="1502249321786" expanded="true" signature="813:821" ph="{...}" /> <marker date="1502936006492" expanded="true" signature="821:829" ph="{...}" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -755,9 +685,7 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17"> <state relative-caret-position="17">
<caret line="1" column="2" lean-forward="true" selection-start-line="1" selection-start-column="2" selection-end-line="1" selection-end-column="2" /> <caret line="1" column="2" lean-forward="true" selection-start-line="1" selection-start-column="2" selection-end-line="1" selection-end-column="2" />
<folding> <folding />
<element signature="e#16#97#0" expanded="false" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
@ -788,7 +716,7 @@
<state relative-caret-position="170"> <state relative-caret-position="170">
<caret line="15" column="2" lean-forward="true" selection-start-line="15" selection-start-column="2" selection-end-line="15" selection-end-column="2" /> <caret line="15" column="2" lean-forward="true" selection-start-line="15" selection-start-column="2" selection-end-line="15" selection-end-column="2" />
<folding> <folding>
<marker date="1502249321786" expanded="true" signature="813:821" ph="{...}" /> <marker date="1502936006492" expanded="true" signature="821:829" ph="{...}" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -804,17 +732,46 @@
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/config.go" /> <entry file="file://$PROJECT_DIR$/config.go" />
<entry file="file://$PROJECT_DIR$/memorycache.go" />
<entry file="file://$PROJECT_DIR$/dbcache.go" />
<entry file="file://$PROJECT_DIR$/app.go" />
<entry file="file://$PROJECT_DIR$/application.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="238">
<caret line="24" column="25" lean-forward="true" selection-start-line="24" selection-start-column="25" selection-end-line="24" selection-end-column="25" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/cachedb.go">
<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>
<entry file="file://$PROJECT_DIR$/cachememory.go">
<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>
<entry file="file://$PROJECT_DIR$/const.go"> <entry file="file://$PROJECT_DIR$/const.go">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="187"> <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" /> <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> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/slice.go"> <entry file="file://$PROJECT_DIR$/context.go">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="799"> <state relative-caret-position="138">
<caret line="48" column="0" lean-forward="false" selection-start-line="48" selection-start-column="0" selection-end-line="48" selection-end-column="0" /> <caret line="34" column="20" lean-forward="false" selection-start-line="34" selection-start-column="20" selection-end-line="34" selection-end-column="20" />
<folding />
</state> </state>
</provider> </provider>
</entry> </entry>
@ -822,33 +779,29 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68"> <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" /> <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> <folding />
<element signature="e#16#97#0" expanded="false" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/error.go"> <entry file="file://$PROJECT_DIR$/error.go">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="391"> <state relative-caret-position="391">
<caret line="23" column="38" lean-forward="false" selection-start-line="23" selection-start-column="38" selection-end-line="23" selection-end-column="38" /> <caret line="23" column="0" lean-forward="false" selection-start-line="23" selection-start-column="0" selection-end-line="23" selection-end-column="0" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/memorycache.go" /> <entry file="file://$PROJECT_DIR$/map.go">
<entry file="file://$PROJECT_DIR$/dbcache.go" />
<entry file="file://$PROJECT_DIR$/context.go">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="238"> <state relative-caret-position="903">
<caret line="19" column="12" lean-forward="false" selection-start-line="19" selection-start-column="12" selection-end-line="19" selection-end-column="12" /> <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 /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/obj.go"> <entry file="file://$PROJECT_DIR$/obj.go">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="952"> <state relative-caret-position="903">
<caret line="56" column="0" lean-forward="false" selection-start-line="56" selection-start-column="0" selection-end-line="56" selection-end-column="0" /> <caret line="56" column="0" lean-forward="false" selection-start-line="56" selection-start-column="0" selection-end-line="56" selection-end-column="0" />
<folding> <folding>
<marker date="1502075126746" expanded="true" signature="176:190" ph="{...}" /> <marker date="1502075126746" expanded="true" signature="176:190" ph="{...}" />
@ -856,14 +809,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/map.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2244">
<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>
<entry file="file://$PROJECT_DIR$/objtoobj.go"> <entry file="file://$PROJECT_DIR$/objtoobj.go">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="306"> <state relative-caret-position="306">
@ -874,14 +819,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/session.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="289">
<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>
<entry file="file://$PROJECT_DIR$/type.go"> <entry file="file://$PROJECT_DIR$/type.go">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="102"> <state relative-caret-position="102">
@ -893,27 +830,59 @@
<entry file="file://$PROJECT_DIR$/var.go"> <entry file="file://$PROJECT_DIR$/var.go">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="204"> <state relative-caret-position="204">
<caret line="12" column="28" lean-forward="false" selection-start-line="12" selection-start-column="28" selection-end-line="12" selection-end-column="28" /> <caret line="12" column="41" lean-forward="false" selection-start-line="12" selection-start-column="41" selection-end-line="12" selection-end-column="41" />
<folding> <folding>
<marker date="1502249321786" expanded="true" signature="813:821" ph="{...}" /> <marker date="1502936006492" expanded="true" signature="821:829" ph="{...}" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/slice.go">
<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>
<entry file="file://$PROJECT_DIR$/session.go">
<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>
<entry file="file://$PROJECT_DIR$/func.go"> <entry file="file://$PROJECT_DIR$/func.go">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2992"> <state relative-caret-position="597">
<caret line="185" column="0" lean-forward="false" selection-start-line="185" selection-start-column="0" selection-end-line="185" selection-end-column="0" /> <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 /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/app.go"> <entry file="file://$PROJECT_DIR$/example/tpt/index.html">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="476"> <state relative-caret-position="68">
<caret line="28" column="6" lean-forward="false" selection-start-line="28" selection-start-column="6" selection-end-line="28" selection-end-column="6" /> <caret line="4" column="16" lean-forward="false" selection-start-line="4" selection-start-column="11" selection-end-line="4" selection-end-column="16" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/config/config.json">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="289">
<caret line="17" column="1" lean-forward="true" selection-start-line="17" selection-start-column="1" selection-end-line="17" selection-end-column="1" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/main.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="153">
<caret line="54" column="53" lean-forward="true" selection-start-line="54" selection-start-column="53" selection-end-line="54" selection-end-column="53" />
<folding> <folding>
<element signature="e#16#138#0" expanded="true" /> <element signature="e#14#101#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>

261
app.go
View File

@ -1,261 +0,0 @@
package hotime
import (
"bytes"
"database/sql"
"encoding/json"
"io/ioutil"
"net/http"
"os"
"path/filepath"
"strconv"
"strings"
)
type App struct {
Router
Error
Port string //端口号
connectListener func(context Context) bool //所有的访问监听,true按原计划继续使用false表示有监听器处理
connectDbFunc func(err ...*Error) *sql.DB
configPath string
Config Map
Db HoTimeDB
CacheIns
sessionLong CacheIns
sessionShort CacheIns
}
//启动实例
func (this *App) Run(router Router) {
this.Router = router
//this.Port = port
this.Port = this.Config.GetString("port")
if this.connectDbFunc != nil {
this.Db.SetConnect(this.connectDbFunc)
}
if this.CacheIns == nil {
this.CacheIns = CacheIns(&CacheMemory{Map: Map{}, Time: this.Config.GetInt64("cacheShortTime")})
}
//http.HandleFunc("/", this.handler)
run(this)
}
//启动实例
func (this *App) SetConnectDB(connect func(err ...*Error) *sql.DB) {
this.connectDbFunc = connect
}
//设置配置文件路径全路径或者相对路径
func (this *App) SetSession(short CacheIns, Long CacheIns) {
this.sessionLong = Long
this.sessionShort = short
}
//默认配置缓存和session实现
func (this *App) SetDefault(connect func(err ...*Error) *sql.DB) {
this.SetConfig()
this.connectDbFunc = connect
//防止手动设置缓存误伤
if this.CacheIns == nil {
this.SetCache(CacheIns(&CacheMemory{}))
}
//防止手动设置session误伤
if this.sessionShort == nil && this.sessionLong == nil {
if this.connectDbFunc == nil {
this.SetSession(CacheIns(&CacheMemory{}), nil)
} else {
this.SetSession(CacheIns(&CacheMemory{}), CacheIns(&CacheDb{Db: &this.Db, Time: this.Config.GetInt64("cacheLongTime")}))
}
}
}
//设置配置文件路径全路径或者相对路径
func (this *App) SetCache(cache CacheIns) {
this.CacheIns = cache
}
//设置配置文件路径全路径或者相对路径
func (this *App) SetConfig(configPath ...string) {
if len(configPath) != 0 {
this.configPath = configPath[0]
}
if this.configPath == "" {
this.configPath = "config/config.json"
}
//加载配置文件
btes, err := ioutil.ReadFile(this.configPath)
this.Config = DeepCopyMap(Config).(Map)
if err == nil {
cmap := Map{}
//文件是否损坏
cmap.JsonToMap(string(btes), &this.Error)
for k, v := range cmap {
this.Config.Put(k, v)
}
}
//else {
// //文件不存在则写入文件,存在不做处理
// var out bytes.Buffer
// err = json.Indent(&out, []byte(this.Config.ToJsonString()), "", "\t")
// os.MkdirAll(filepath.Dir(this.configPath), os.ModeDir)
// os.Create(this.configPath)
// err = ioutil.WriteFile(this.configPath, out.Bytes(), os.ModeAppend)
// if err != nil {
// this.Error.SetError(err)
// }
//}
//文件如果损坏则不写入配置防止配置文件数据丢失
if this.Error.GetError() == nil {
var out bytes.Buffer
err = json.Indent(&out, []byte(this.Config.ToJsonString()), "", "\t")
err = ioutil.WriteFile(this.configPath, out.Bytes(), os.ModeAppend)
if err != nil {
os.MkdirAll(filepath.Dir(this.configPath), os.ModeDir)
os.Create(this.configPath)
err = ioutil.WriteFile(this.configPath, out.Bytes(), os.ModeAppend)
if err != nil {
this.Error.SetError(err)
}
}
} else {
this.Error.SetError(nil)
}
}
//连接判断,返回true继续传输至控制层false则停止传输
func (this *App) SetConnectListener(lis func(context Context) bool) {
this.connectListener = lis
}
//网络错误
func (this *App) session(w http.ResponseWriter, req *http.Request) {
}
//访问
func (this *App) handler(w http.ResponseWriter, req *http.Request) {
q := strings.Index(req.RequestURI, "?")
if q == -1 {
q = len(req.RequestURI)
}
o := Substr(req.RequestURI, 0, q)
r := strings.SplitN(o, "/", -1)
var s = make([]string, 0)
for i := 0; i < len(r); i++ {
if !strings.EqualFold("", r[i]) {
s = append(s, r[i])
}
}
//接口服务
if len(s) == 3 {
//如果满足规则则路由到对应控制器去
if this.Router[s[0]] != nil && this.Router[s[0]][s[1]] != nil && this.Router[s[0]][s[1]][s[2]] != nil {
//获取cookie
// 如果cookie存在直接将sessionId赋值为cookie.Value
// 如果cookie不存在就查找传入的参数中是否有token
// 如果token不存在就生成随机的sessionId
// 如果token存在就判断token是否在Session中有保存
// 如果有取出token并复制给cookie
// 没有保存就生成随机的session
cookie, err := req.Cookie((Config["sessionName"]).(string))
sessionId := Md5(strconv.Itoa(Rand(10)))
token := req.FormValue("token")
//isFirst:=false
if err != nil || (len(token) == 32 && cookie.Value != token) {
if len(token) == 32 {
sessionId = token
}
//else{
// isFirst=true;
//}
http.SetCookie(w, &http.Cookie{Name: Config["sessionName"].(string), Value: sessionId, Path: "/"})
} else {
sessionId = cookie.Value
}
//访问实例
context := Context{SessionIns: SessionIns{SessionId: sessionId,
LongCache: this.sessionLong,
ShortCache: this.sessionShort,
},
CacheIns: this.CacheIns,
Resp: w, Req: req, App: this, RouterString: s, Config: this.Config, Db: &this.Db}
//访问拦截
if this.connectListener != nil {
if !this.connectListener(context) {
context.View()
return
}
}
//控制层
this.Router[s[0]][s[1]][s[2]](&context)
context.View()
return
}
}
//url赋值
path := Config.GetString("tpt") + o
//判断是否为默认
if path[len(path)-1] == '/' {
defFile := Config["defFile"].([]string)
for i := 0; i < len(defFile); i++ {
temp := path + defFile[i]
_, err := os.Stat(temp)
if err == nil {
path = temp
break
}
}
if path[len(path)-1] == '/' {
w.WriteHeader(404)
return
}
}
if strings.Contains(path, "/.") {
w.WriteHeader(404)
return
}
header := w.Header()
//类型判断并设置Content-Type
if strings.Contains(path, ".css") {
header.Set("Content-Type", "text/css")
//header.Get(Config["sessionName"].(string))
}
header.Set("Cache-Control", "public")
//w.Write(data)
http.ServeFile(w, req, path)
}