This commit is contained in:
hoteas 2017-08-23 02:33:51 +00:00
parent 22c46eebd9
commit c01dc6b5af
5 changed files with 121 additions and 108 deletions

View File

@ -6,7 +6,10 @@
<component name="ChangeListManager">
<list default="true" readonly="true" id="03ed5703-81a1-441b-849c-c426276586b7" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/config/config.json" afterPath="$PROJECT_DIR$/config/config.json" />
<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" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/func.go" afterPath="$PROJECT_DIR$/func.go" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
@ -18,6 +21,19 @@
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FileEditorManager">
<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="167">
<caret line="43" column="6" lean-forward="true" selection-start-line="43" selection-start-column="6" selection-end-line="43" selection-end-column="6" />
<folding>
<marker date="1503369750531" expanded="true" signature="164:222" ph="{...}" />
<marker date="1503369750531" expanded="true" signature="5062:5989" ph="{...}" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="const.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/const.go">
<provider selected="true" editor-type-id="text-editor">
@ -55,27 +71,29 @@
<entry file="file://$PROJECT_DIR$/config/config.json">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="238">
<caret line="14" column="17" lean-forward="false" selection-start-line="14" selection-start-column="17" selection-end-line="14" selection-end-column="17" />
<caret line="14" column="15" lean-forward="false" selection-start-line="14" selection-start-column="15" selection-end-line="14" selection-end-column="15" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="func.go" pinned="false" current-in-tab="false">
<file leaf-file-name="func.go" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/func.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2065">
<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 relative-caret-position="306">
<caret line="18" column="0" lean-forward="true" selection-start-line="18" selection-start-column="0" selection-end-line="18" selection-end-column="0" />
<folding>
<element signature="e#16#116#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="main.go" pinned="false" current-in-tab="true">
<file leaf-file-name="main.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/main.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="289">
<caret line="56" column="28" lean-forward="false" selection-start-line="56" selection-start-column="28" selection-end-line="56" selection-end-column="28" />
<state relative-caret-position="184">
<caret line="16" column="19" lean-forward="false" selection-start-line="16" selection-start-column="19" selection-end-line="16" selection-end-column="19" />
<folding>
<element signature="e#14#137#0" expanded="true" />
</folding>
@ -83,6 +101,26 @@
</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="291">
<caret line="37" column="5" lean-forward="true" selection-start-line="37" selection-start-column="5" selection-end-line="37" selection-end-column="5" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="config.json" pinned="false" current-in-tab="false">
<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>
</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">
@ -93,38 +131,6 @@
</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="85">
<caret line="5" column="4" lean-forward="false" selection-start-line="5" selection-start-column="4" selection-end-line="5" selection-end-column="4" />
<folding />
</state>
</provider>
</entry>
</file>
<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="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" />
<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="136">
<caret line="8" column="15" lean-forward="false" selection-start-line="8" selection-start-column="15" selection-end-line="8" selection-end-column="15" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
@ -158,20 +164,20 @@
<option value="$PROJECT_DIR$/dbcache.go" />
<option value="$PROJECT_DIR$/type.go" />
<option value="$PROJECT_DIR$/app.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$/application.go" />
<option value="$PROJECT_DIR$/base.go" />
<option value="$PROJECT_DIR$/base_context.go" />
<option value="$PROJECT_DIR$/db.go" />
<option value="$PROJECT_DIR$/cache_db.go" />
<option value="$PROJECT_DIR$/cache_memory.go" />
<option value="$PROJECT_DIR$/obj.go" />
<option value="$PROJECT_DIR$/session.go" />
<option value="$PROJECT_DIR$/context.go" />
<option value="$PROJECT_DIR$/example/main.go" />
<option value="$PROJECT_DIR$/db.go" />
<option value="$PROJECT_DIR$/config/config.json" />
<option value="$PROJECT_DIR$/func.go" />
</list>
</option>
</component>
@ -637,7 +643,7 @@
<workItem from="1502760226287" duration="153000" />
<workItem from="1502935911308" duration="1724000" />
<workItem from="1503366689326" duration="2378000" />
<workItem from="1503451223794" duration="2965000" />
<workItem from="1503451223794" duration="4426000" />
</task>
<task id="LOCAL-00001">
<created>1500458878821</created>
@ -751,11 +757,18 @@
<option name="project" value="LOCAL" />
<updated>1503454064456</updated>
</task>
<option name="localTasksCounter" value="17" />
<task id="LOCAL-00017" summary="demo">
<created>1503454197179</created>
<option name="number" value="00017" />
<option name="presentableId" value="LOCAL-00017" />
<option name="project" value="LOCAL" />
<updated>1503454197179</updated>
</task>
<option name="localTasksCounter" value="18" />
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="61222000" />
<option name="totallyTimeSpent" value="62683000" />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
@ -775,11 +788,11 @@
<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" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3997923" 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="true" show_stripe_button="true" weight="0.3997923" sideWeight="0.5" order="3" 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="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" />
@ -806,15 +819,7 @@
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/example/main.go</url>
<line>16</line>
<properties />
<option name="timeStamp" value="1" />
</line-breakpoint>
</breakpoints>
<option name="time" value="2" />
<option name="time" value="3" />
</breakpoint-manager>
<watches-manager />
</component>
@ -1024,24 +1029,6 @@
</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" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/application.go">
<provider selected="true" editor-type-id="text-editor">
<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="{...}" />
</folding>
</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">
@ -1068,14 +1055,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/db.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="323">
<caret line="26" column="86" lean-forward="true" selection-start-line="26" selection-start-column="86" selection-end-line="26" selection-end-column="86" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/cache_db.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="119">
@ -1152,14 +1131,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/func.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2065">
<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>
<entry file="file://$PROJECT_DIR$/error.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="391">
@ -1176,14 +1147,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/config/config.json">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="238">
<caret line="14" column="17" lean-forward="false" selection-start-line="14" selection-start-column="17" selection-end-line="14" selection-end-column="17" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/context.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="510">
@ -1195,15 +1158,60 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/main.go">
<entry file="file://$PROJECT_DIR$/example/config/config.json">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="289">
<caret line="56" column="28" lean-forward="false" selection-start-line="56" selection-start-column="28" selection-end-line="56" selection-end-column="28" />
<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$/application.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="167">
<caret line="43" column="6" lean-forward="true" selection-start-line="43" selection-start-column="6" selection-end-line="43" selection-end-column="6" />
<folding>
<marker date="1503369750531" expanded="true" signature="164:222" ph="{...}" />
<marker date="1503369750531" expanded="true" signature="5062:5989" ph="{...}" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/config/config.json">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="238">
<caret line="14" column="15" lean-forward="false" selection-start-line="14" selection-start-column="15" selection-end-line="14" selection-end-column="15" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/main.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="184">
<caret line="16" column="19" lean-forward="false" selection-start-line="16" selection-start-column="19" selection-end-line="16" selection-end-column="19" />
<folding>
<element signature="e#14#137#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/db.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="291">
<caret line="37" column="5" lean-forward="true" selection-start-line="37" selection-start-column="5" selection-end-line="37" selection-end-column="5" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/func.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="306">
<caret line="18" column="0" lean-forward="true" selection-start-line="18" selection-start-column="0" selection-end-line="18" selection-end-column="0" />
<folding>
<element signature="e#16#116#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
</project>

View File

@ -12,7 +12,7 @@
],
"error": {},
"logLevel": 0,
"port": "8080",
"port": "80",
"sessionName": "HOTIME",
"tpt": "tpt"
}

4
db.go
View File

@ -43,12 +43,12 @@ func (this *HoTimeDB) Action(action func() bool) bool {
if !result {
this.Tx.Rollback()
this.Tx = nil
return true
return result
}
this.Tx.Commit()
this.Tx = nil
return true
return result
}
func (this *HoTimeDB) InitDb(err ...*Error) Error {

View File

@ -50,11 +50,13 @@ func main() {
"index": hotime.Ctr{
"test": func(this *hotime.Context) {
fmt.Println(this.Db.GetTag())
this.Db.Action(func() bool {
x:=this.Db.Action(func() bool {
return true
this.Db.Insert("user",hotime.Map{"unickname":"dasdas"})
return false
})
this.Display(5, "chenggong")
this.Display(5, x)
},
"websocket": func(this *hotime.Context) {
hdler := websocket.Handler(func(ws *websocket.Conn) {

View File

@ -304,8 +304,11 @@ func run(a *Application) {
if !IsRun {
http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
port := Substr(req.Host, IndexLastStr(req.Host, ":")+1, len(req.Host))
//fmt.Println(port)
port:="80"
if IndexLastStr(req.Host, ":")!=-1{
port = Substr(req.Host, IndexLastStr(req.Host, ":")+1, len(req.Host))
}
if application[port] != nil {
application[port].handler(w, req)
}