数据库缓存更新
This commit is contained in:
parent
546058513f
commit
e5eaa97ff9
401
.idea/workspace.xml
generated
401
.idea/workspace.xml
generated
@ -6,9 +6,13 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" readonly="true" id="03ed5703-81a1-441b-849c-c426276586b7" name="Default" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
||||
<change beforePath="$PROJECT_DIR$/example/config/config.json" afterPath="$PROJECT_DIR$/example/config/config.json" />
|
||||
<change beforePath="$PROJECT_DIR$/cache/cache_redis.go" afterPath="$PROJECT_DIR$/cache/cache_redis.go" />
|
||||
<change beforePath="$PROJECT_DIR$/cache_db.go" afterPath="$PROJECT_DIR$/cache_db.go" />
|
||||
<change beforePath="$PROJECT_DIR$/cache_memory.go" afterPath="$PROJECT_DIR$/cache_memory.go" />
|
||||
<change beforePath="$PROJECT_DIR$/db.go" afterPath="$PROJECT_DIR$/db.go" />
|
||||
<change beforePath="$PROJECT_DIR$/example/main.go" afterPath="$PROJECT_DIR$/example/main.go" />
|
||||
<change beforePath="$PROJECT_DIR$/example/tpt/index.html" afterPath="$PROJECT_DIR$/example/tpt/index.html" />
|
||||
<change beforePath="$PROJECT_DIR$/obj.go" afterPath="$PROJECT_DIR$/obj.go" />
|
||||
<change beforePath="$PROJECT_DIR$/objtoobj.go" afterPath="$PROJECT_DIR$/objtoobj.go" />
|
||||
</list>
|
||||
<ignored path=".idea/dataSources.local.xml" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
@ -29,30 +33,20 @@
|
||||
<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="256">
|
||||
<caret line="82" column="31" lean-forward="true" selection-start-line="82" selection-start-column="31" selection-end-line="82" selection-end-column="31" />
|
||||
<state relative-caret-position="220">
|
||||
<caret line="88" column="43" lean-forward="true" selection-start-line="88" selection-start-column="43" selection-end-line="88" selection-end-column="43" />
|
||||
<folding>
|
||||
<element signature="e#14#177#0" expanded="true" />
|
||||
<element signature="e#14#207#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="index.html" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/example/tpt/index.html">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="165">
|
||||
<caret line="11" column="0" lean-forward="false" selection-start-line="11" selection-start-column="0" selection-end-line="11" selection-end-column="0" />
|
||||
<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="165">
|
||||
<caret line="11" column="4" lean-forward="false" selection-start-line="11" selection-start-column="4" selection-end-line="11" selection-end-column="4" />
|
||||
<state relative-caret-position="105">
|
||||
<caret line="7" column="13" lean-forward="false" selection-start-line="7" selection-start-column="5" selection-end-line="7" selection-end-column="13" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
@ -61,8 +55,8 @@
|
||||
<file leaf-file-name="cache_redis.go" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/cache/cache_redis.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1575">
|
||||
<caret line="110" column="50" lean-forward="false" selection-start-line="110" selection-start-column="50" selection-end-line="110" selection-end-column="50" />
|
||||
<state relative-caret-position="180">
|
||||
<caret line="12" column="14" lean-forward="true" selection-start-line="12" selection-start-column="14" selection-end-line="12" selection-end-column="14" />
|
||||
<folding>
|
||||
<element signature="e#15#106#0" expanded="true" />
|
||||
</folding>
|
||||
@ -70,11 +64,11 @@
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="strings.go" pinned="false" current-in-tab="false">
|
||||
<entry file="file://D:/app/go/src/strings/strings.go">
|
||||
<file leaf-file-name="cache_memory.go" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/cache_memory.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1335">
|
||||
<caret line="92" column="15" lean-forward="false" selection-start-line="92" selection-start-column="15" selection-end-line="92" selection-end-column="15" />
|
||||
<state relative-caret-position="225">
|
||||
<caret line="19" column="18" lean-forward="true" selection-start-line="19" selection-start-column="18" selection-end-line="19" selection-end-column="18" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
@ -83,38 +77,8 @@
|
||||
<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="2985">
|
||||
<caret line="204" column="5" lean-forward="false" selection-start-line="204" selection-start-column="5" selection-end-line="204" selection-end-column="5" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="cache_memory.go" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/cache_memory.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="915">
|
||||
<caret line="64" column="0" lean-forward="false" selection-start-line="64" selection-start-column="0" selection-end-line="64" selection-end-column="0" />
|
||||
<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="210">
|
||||
<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>
|
||||
</file>
|
||||
<file leaf-file-name="cache_db.go" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/cache_db.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="105">
|
||||
<caret line="10" column="10" lean-forward="false" selection-start-line="10" selection-start-column="10" selection-end-line="10" selection-end-column="10" />
|
||||
<state relative-caret-position="255">
|
||||
<caret line="52" column="18" lean-forward="false" selection-start-line="52" selection-start-column="18" selection-end-line="52" selection-end-column="18" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
@ -123,8 +87,48 @@
|
||||
<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="4860">
|
||||
<caret line="331" column="27" lean-forward="false" selection-start-line="331" selection-start-column="27" selection-end-line="331" selection-end-column="27" />
|
||||
<state relative-caret-position="370">
|
||||
<caret line="893" column="9" lean-forward="true" selection-start-line="893" selection-start-column="9" selection-end-line="893" selection-end-column="9" />
|
||||
<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="135">
|
||||
<caret line="11" column="17" lean-forward="false" selection-start-line="11" selection-start-column="17" selection-end-line="11" selection-end-column="17" />
|
||||
<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="468">
|
||||
<caret line="66" column="24" lean-forward="false" selection-start-line="66" selection-start-column="24" selection-end-line="66" selection-end-column="24" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="cache_db.go" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/cache_db.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="281">
|
||||
<caret line="77" column="51" lean-forward="false" selection-start-line="77" selection-start-column="51" selection-end-line="77" selection-end-column="51" />
|
||||
<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="-765">
|
||||
<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>
|
||||
@ -148,6 +152,11 @@
|
||||
<find>GetString</find>
|
||||
<find>CacheMemory</find>
|
||||
<find>GetTag</find>
|
||||
<find>copy</find>
|
||||
<find>Cached</find>
|
||||
<find>md5</find>
|
||||
<find>Query</find>
|
||||
<find>cacheMutex</find>
|
||||
</findStrings>
|
||||
<replaceStrings>
|
||||
<replace>MUTEX_SESSION_TYPE</replace>
|
||||
@ -163,7 +172,6 @@
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/objtoobj.go" />
|
||||
<option value="$PROJECT_DIR$/controller.go" />
|
||||
<option value="$PROJECT_DIR$/Config.go" />
|
||||
<option value="$PROJECT_DIR$/config.go" />
|
||||
@ -176,11 +184,8 @@
|
||||
<option value="$PROJECT_DIR$/base.go" />
|
||||
<option value="$PROJECT_DIR$/base_context.go" />
|
||||
<option value="$PROJECT_DIR$/context_base.go" />
|
||||
<option value="$PROJECT_DIR$/obj.go" />
|
||||
<option value="$PROJECT_DIR$/cache_db.go" />
|
||||
<option value="$PROJECT_DIR$/context.go" />
|
||||
<option value="$PROJECT_DIR$/config/config.json" />
|
||||
<option value="$PROJECT_DIR$/db.go" />
|
||||
<option value="$PROJECT_DIR$/manage/manage.go" />
|
||||
<option value="$PROJECT_DIR$/slice.go" />
|
||||
<option value="$PROJECT_DIR$/dri/upload/upload.go" />
|
||||
@ -191,12 +196,16 @@
|
||||
<option value="$PROJECT_DIR$/const.go" />
|
||||
<option value="$PROJECT_DIR$/func.go" />
|
||||
<option value="$PROJECT_DIR$/error.go" />
|
||||
<option value="$PROJECT_DIR$/cache_memory.go" />
|
||||
<option value="$PROJECT_DIR$/cache_redis.go" />
|
||||
<option value="$PROJECT_DIR$/type.go" />
|
||||
<option value="$PROJECT_DIR$/cache/cache_redis.go" />
|
||||
<option value="$PROJECT_DIR$/example/config/config.json" />
|
||||
<option value="$PROJECT_DIR$/example/tpt/index.html" />
|
||||
<option value="$PROJECT_DIR$/obj.go" />
|
||||
<option value="$PROJECT_DIR$/objtoobj.go" />
|
||||
<option value="$PROJECT_DIR$/cache_memory.go" />
|
||||
<option value="$PROJECT_DIR$/cache_db.go" />
|
||||
<option value="$PROJECT_DIR$/cache/cache_redis.go" />
|
||||
<option value="$PROJECT_DIR$/db.go" />
|
||||
<option value="$PROJECT_DIR$/example/main.go" />
|
||||
</list>
|
||||
</option>
|
||||
@ -211,9 +220,9 @@
|
||||
<servers />
|
||||
</component>
|
||||
<component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
|
||||
<component name="ProjectFrameBounds">
|
||||
<option name="x" value="55" />
|
||||
<option name="y" value="-8" />
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="x" value="-673" />
|
||||
<option name="y" value="310" />
|
||||
<option name="width" value="1873" />
|
||||
<option name="height" value="1084" />
|
||||
</component>
|
||||
@ -232,6 +241,10 @@
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="PackagesPane" />
|
||||
<pane id="Scratches" />
|
||||
<pane id="AndroidView" />
|
||||
<pane id="Scope" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
@ -265,10 +278,6 @@
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scope" />
|
||||
<pane id="AndroidView" />
|
||||
<pane id="Scratches" />
|
||||
<pane id="PackagesPane" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
@ -473,7 +482,8 @@
|
||||
<workItem from="1522778115746" duration="44000" />
|
||||
<workItem from="1522778659126" duration="455000" />
|
||||
<workItem from="1522779789231" duration="6991000" />
|
||||
<workItem from="1523202491878" duration="835000" />
|
||||
<workItem from="1523202491878" duration="853000" />
|
||||
<workItem from="1523288830673" duration="5049000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001">
|
||||
<created>1500458878821</created>
|
||||
@ -671,11 +681,18 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1522782970484</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="29" />
|
||||
<task id="LOCAL-00029" summary="工具">
|
||||
<created>1523203335093</created>
|
||||
<option name="number" value="00029" />
|
||||
<option name="presentableId" value="LOCAL-00029" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1523203335093</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="30" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="101505000" />
|
||||
<option name="totallyTimeSpent" value="106572000" />
|
||||
</component>
|
||||
<component name="TodoView">
|
||||
<todo-panel id="selected-file">
|
||||
@ -687,7 +704,7 @@
|
||||
</todo-panel>
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="55" y="-8" width="1873" height="1084" extended-state="0" />
|
||||
<frame x="54" y="-8" width="1874" height="1096" extended-state="6" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<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" />
|
||||
@ -696,12 +713,12 @@
|
||||
<window_info id="Capture Analysis" 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="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="Maven Projects" 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="true" show_stripe_button="true" weight="0.32911393" 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.6329114" 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.328125" 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.6322917" 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.32805908" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Capture Tool" 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="false" content_ui="tabs" />
|
||||
<window_info id="Designer" 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="false" content_ui="tabs" />
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.37341422" 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.22657111" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
||||
<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="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="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
@ -745,7 +762,91 @@
|
||||
<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>
|
||||
<element signature="e#14#177#0" expanded="true" />
|
||||
<element signature="e#14#207#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/tpt/index.html">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="165">
|
||||
<caret line="11" column="0" lean-forward="false" selection-start-line="11" selection-start-column="0" selection-end-line="11" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/type.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="165">
|
||||
<caret line="11" column="4" lean-forward="false" selection-start-line="11" selection-start-column="4" selection-end-line="11" selection-end-column="4" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/cache/cache_redis.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1575">
|
||||
<caret line="110" column="50" lean-forward="false" selection-start-line="110" selection-start-column="50" selection-end-line="110" selection-end-column="50" />
|
||||
<folding>
|
||||
<element signature="e#15#106#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://D:/app/go/src/strings/strings.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1335">
|
||||
<caret line="92" column="15" lean-forward="false" selection-start-line="92" selection-start-column="15" selection-end-line="92" selection-end-column="15" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/objtoobj.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="2985">
|
||||
<caret line="204" column="5" lean-forward="false" selection-start-line="204" selection-start-column="5" selection-end-line="204" selection-end-column="5" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/cache_memory.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="915">
|
||||
<caret line="64" column="0" lean-forward="false" selection-start-line="64" selection-start-column="0" selection-end-line="64" selection-end-column="0" />
|
||||
<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="210">
|
||||
<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$/cache_db.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="105">
|
||||
<caret line="10" column="10" lean-forward="false" selection-start-line="10" selection-start-column="10" selection-end-line="10" selection-end-column="10" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/db.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="4860">
|
||||
<caret line="331" column="27" lean-forward="false" selection-start-line="331" selection-start-column="27" selection-end-line="331" selection-end-column="27" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/main.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>
|
||||
<element signature="e#14#207#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
@ -820,7 +921,6 @@
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="195">
|
||||
<caret line="13" column="16" lean-forward="true" selection-start-line="13" selection-start-column="16" selection-end-line="13" selection-end-column="16" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -829,7 +929,7 @@
|
||||
<state relative-caret-position="270">
|
||||
<caret line="18" column="29" lean-forward="false" selection-start-line="18" selection-start-column="29" selection-end-line="18" selection-end-column="29" />
|
||||
<folding>
|
||||
<element signature="e#14#177#0" expanded="true" />
|
||||
<element signature="e#14#207#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
@ -847,7 +947,7 @@
|
||||
<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>
|
||||
<element signature="e#14#177#0" expanded="true" />
|
||||
<element signature="e#14#207#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
@ -865,23 +965,6 @@
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="195">
|
||||
<caret line="13" column="16" lean-forward="false" selection-start-line="13" selection-start-column="16" selection-end-line="13" selection-end-column="16" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/cache_memory.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="915">
|
||||
<caret line="64" column="0" lean-forward="false" selection-start-line="64" selection-start-column="0" selection-end-line="64" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/objtoobj.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="2985">
|
||||
<caret line="204" column="5" lean-forward="false" selection-start-line="204" selection-start-column="5" selection-end-line="204" selection-end-column="5" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -893,40 +976,6 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/type.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="165">
|
||||
<caret line="11" column="4" lean-forward="false" selection-start-line="11" selection-start-column="4" selection-end-line="11" selection-end-column="4" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/cache/cache_redis.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1575">
|
||||
<caret line="110" column="50" lean-forward="false" selection-start-line="110" selection-start-column="50" selection-end-line="110" selection-end-column="50" />
|
||||
<folding>
|
||||
<element signature="e#15#106#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/cache_db.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="105">
|
||||
<caret line="10" column="10" lean-forward="false" selection-start-line="10" selection-start-column="10" selection-end-line="10" selection-end-column="10" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/db.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="4860">
|
||||
<caret line="331" column="27" lean-forward="false" selection-start-line="331" selection-start-column="27" selection-end-line="331" selection-end-column="27" />
|
||||
<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="210">
|
||||
@ -943,12 +992,94 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/var.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$/type.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="105">
|
||||
<caret line="7" column="13" lean-forward="false" selection-start-line="7" selection-start-column="5" selection-end-line="7" selection-end-column="13" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/func.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-765">
|
||||
<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$/obj.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="468">
|
||||
<caret line="66" column="24" lean-forward="false" selection-start-line="66" selection-start-column="24" selection-end-line="66" selection-end-column="24" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/error.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="135">
|
||||
<caret line="11" column="17" lean-forward="false" selection-start-line="11" selection-start-column="17" selection-end-line="11" selection-end-column="17" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/cache/cache_redis.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="180">
|
||||
<caret line="12" column="14" lean-forward="true" selection-start-line="12" selection-start-column="14" selection-end-line="12" selection-end-column="14" />
|
||||
<folding>
|
||||
<element signature="e#15#106#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/cache_memory.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="225">
|
||||
<caret line="19" column="18" lean-forward="true" selection-start-line="19" selection-start-column="18" selection-end-line="19" selection-end-column="18" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/objtoobj.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="255">
|
||||
<caret line="52" column="18" lean-forward="false" selection-start-line="52" selection-start-column="18" selection-end-line="52" selection-end-column="18" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/db.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="370">
|
||||
<caret line="893" column="9" lean-forward="true" selection-start-line="893" selection-start-column="9" selection-end-line="893" selection-end-column="9" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/cache_db.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="281">
|
||||
<caret line="77" column="51" lean-forward="false" selection-start-line="77" selection-start-column="51" selection-end-line="77" selection-end-column="51" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/main.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="256">
|
||||
<caret line="82" column="31" lean-forward="true" selection-start-line="82" selection-start-column="31" selection-end-line="82" selection-end-column="31" />
|
||||
<state relative-caret-position="220">
|
||||
<caret line="88" column="43" lean-forward="true" selection-start-line="88" selection-start-column="43" selection-end-line="88" selection-end-column="43" />
|
||||
<folding>
|
||||
<element signature="e#14#177#0" expanded="true" />
|
||||
<element signature="e#14#207#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
|
117
cache/cache_redis.go
vendored
117
cache/cache_redis.go
vendored
@ -42,42 +42,20 @@ func (this *CacheRedis) reCon()bool{
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (this *CacheRedis) Cache(key string, data ...interface{}) *Obj {
|
||||
reData:= &Obj{}
|
||||
var err error
|
||||
if this.conn==nil{
|
||||
re:=this.reCon()
|
||||
if !re{
|
||||
return reData
|
||||
func (this *CacheRedis) del(key string) {
|
||||
del:=strings.Index(key,"*")
|
||||
if del!=-1{
|
||||
val, err := redis.Strings(this.conn.Do("KEYS", key))
|
||||
if err!=nil{
|
||||
return
|
||||
}
|
||||
}
|
||||
//查询缓存
|
||||
if len(data) == 0 {
|
||||
|
||||
reData.Data, err = redis.String(this.conn.Do("GET", key))
|
||||
if err != nil {
|
||||
reData.Data=nil
|
||||
if !strings.Contains(err.Error(), "nil returned") {
|
||||
this.Error.SetError(err)
|
||||
_, err = this.conn.Do("PING")
|
||||
if err != nil {
|
||||
if this.reCon() {
|
||||
reData.Data, err = redis.String(this.conn.Do("GET", key))
|
||||
}
|
||||
}
|
||||
|
||||
return reData
|
||||
}
|
||||
this.conn.Send("MULTI")
|
||||
for i, _ := range val {
|
||||
this.conn.Send("DEL", val[i])
|
||||
}
|
||||
return reData
|
||||
|
||||
}
|
||||
tim := int64(0)
|
||||
//删除缓存
|
||||
if len(data) == 1 && data[0] == nil {
|
||||
|
||||
_,err=this.conn.Do("DEL",key)
|
||||
this.conn.Do("EXEC")
|
||||
}else{
|
||||
_,err:=this.conn.Do("DEL",key)
|
||||
if err!=nil{
|
||||
this.Error.SetError(err)
|
||||
_,err=this.conn.Do("PING")
|
||||
@ -87,6 +65,65 @@ func (this *CacheRedis) Cache(key string, data ...interface{}) *Obj {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//key value ,时间为时间戳
|
||||
func (this *CacheRedis) set(key string, value string, time int64) {
|
||||
_,err:=this.conn.Do("SET",key,value,"EX",ObjToStr(time))
|
||||
if err!=nil{
|
||||
|
||||
this.Error.SetError(err)
|
||||
_,err=this.conn.Do("PING")
|
||||
if err!=nil{
|
||||
if this.reCon(){
|
||||
_,err=this.conn.Do("SET",key,value,"EX",ObjToStr(time))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func (this *CacheRedis) get(key string) *Obj{
|
||||
reData:= &Obj{}
|
||||
var err error
|
||||
reData.Data, err = redis.String(this.conn.Do("GET", key))
|
||||
if err != nil {
|
||||
reData.Data=nil
|
||||
if !strings.Contains(err.Error(), "nil returned") {
|
||||
this.Error.SetError(err)
|
||||
_, err = this.conn.Do("PING")
|
||||
if err != nil {
|
||||
if this.reCon() {
|
||||
reData.Data, err = redis.String(this.conn.Do("GET", key))
|
||||
}
|
||||
}
|
||||
|
||||
return reData
|
||||
}
|
||||
}
|
||||
return reData
|
||||
}
|
||||
|
||||
func (this *CacheRedis) Cache(key string, data ...interface{}) *Obj {
|
||||
reData:= &Obj{}
|
||||
if this.conn==nil{
|
||||
re:=this.reCon()
|
||||
if !re{
|
||||
return reData
|
||||
}
|
||||
}
|
||||
//查询缓存
|
||||
if len(data) == 0 {
|
||||
|
||||
reData=this.get(key)
|
||||
return reData
|
||||
|
||||
}
|
||||
tim := int64(0)
|
||||
//删除缓存
|
||||
if len(data) == 1 && data[0] == nil {
|
||||
this.del(key)
|
||||
return reData
|
||||
}
|
||||
//添加缓存
|
||||
@ -108,17 +145,9 @@ func (this *CacheRedis) Cache(key string, data ...interface{}) *Obj {
|
||||
}
|
||||
}
|
||||
|
||||
_,err=this.conn.Do("SET",key,ObjToStr(data[0]),"EX",ObjToStr(tim))
|
||||
if err!=nil{
|
||||
|
||||
this.Error.SetError(err)
|
||||
_,err=this.conn.Do("PING")
|
||||
if err!=nil{
|
||||
if this.reCon(){
|
||||
_,err=this.conn.Do("SET",key,ObjToStr(data[0]),"EX",ObjToStr(tim))
|
||||
}
|
||||
}
|
||||
}
|
||||
this.set(key,ObjToStr(data[0]),tim)
|
||||
|
||||
return reData
|
||||
|
||||
}
|
||||
|
12
cache_db.go
12
cache_db.go
@ -3,6 +3,7 @@ package hotime
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type CacheDb struct {
|
||||
@ -69,7 +70,16 @@ func (this *CacheDb) set(key string, value interface{}, tim int64) {
|
||||
}
|
||||
|
||||
func (this *CacheDb) delete(key string) {
|
||||
this.Db.Delete("cached", Map{"ckey": key})
|
||||
|
||||
del:=strings.Index(key,"*")
|
||||
//如果通配删除
|
||||
if del!=-1{
|
||||
key=Substr(key,0,del)
|
||||
this.Db.Delete("cached", Map{"ckey": key+"%"})
|
||||
|
||||
}else{
|
||||
this.Db.Delete("cached", Map{"ckey": key})
|
||||
}
|
||||
}
|
||||
|
||||
func (this *CacheDb) Cache(key string, data ...interface{}) *Obj {
|
||||
|
@ -3,6 +3,7 @@ package hotime
|
||||
import (
|
||||
"time"
|
||||
"sync"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type CacheMemory struct {
|
||||
@ -70,8 +71,20 @@ func (this *CacheMemory) set(key string, value interface{}, time int64) {
|
||||
}
|
||||
|
||||
func (this *CacheMemory) delete(key string) {
|
||||
del:=strings.Index(key,"*")
|
||||
//如果通配删除
|
||||
if del!=-1{
|
||||
key=Substr(key,0,del)
|
||||
for k,_:=range this.Map{
|
||||
if strings.Index(k,key)!=-1{
|
||||
delete(this.Map, key)
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
delete(this.Map, key)
|
||||
}
|
||||
|
||||
delete(this.Map, key)
|
||||
}
|
||||
|
||||
func (this *CacheMemory) Cache(key string, data ...interface{}) *Obj {
|
||||
|
77
db.go
77
db.go
@ -7,13 +7,13 @@ import (
|
||||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type HoTimeDB struct {
|
||||
*sql.DB
|
||||
contextBase
|
||||
|
||||
Cached bool
|
||||
CacheIns
|
||||
LastQuery string
|
||||
LastData []interface{}
|
||||
ConnectFunc func(err ...*Error) *sql.DB
|
||||
@ -31,7 +31,7 @@ func (this *HoTimeDB) SetConnect(connect func(err ...*Error) *sql.DB, err ...*Er
|
||||
|
||||
//事务,如果action返回true则执行成功;false则回滚
|
||||
func (this *HoTimeDB) Action(action func(db HoTimeDB) bool) bool {
|
||||
db := HoTimeDB{DB: this.DB, Cached: this.Cached}
|
||||
db := HoTimeDB{DB: this.DB,CacheIns:this.CacheIns}
|
||||
tx, err := db.Begin()
|
||||
if err != nil {
|
||||
this.LastErr.SetError(err)
|
||||
@ -426,11 +426,32 @@ func (this *HoTimeDB) Select(table string, qu ...interface{}) []Map {
|
||||
|
||||
query += temp
|
||||
qs = append(qs, resWhere...)
|
||||
md5:=this.md5(query,qs...)
|
||||
//如果缓存有则从缓存取
|
||||
cacheData:=this.Cache(table+":"+md5)
|
||||
|
||||
res := this.Query(query, qs...)
|
||||
if res == nil {
|
||||
return []Map{}
|
||||
if cacheData.Data!=nil{
|
||||
return cacheData.ToMapArray()
|
||||
}
|
||||
|
||||
//无缓存则数据库取
|
||||
res := this.Query(query, qs...)
|
||||
|
||||
|
||||
|
||||
if res == nil {
|
||||
res=[]Map{}
|
||||
}
|
||||
|
||||
//缓存
|
||||
if this.CacheIns!=nil{
|
||||
|
||||
this.Cache(table+":"+md5,res)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return res
|
||||
|
||||
}
|
||||
@ -796,13 +817,18 @@ func (this *HoTimeDB) Update(table string, data Map, where Map) int64 {
|
||||
|
||||
res, err := this.Exec(query, qs...)
|
||||
|
||||
if err.GetError() != nil {
|
||||
|
||||
return 0
|
||||
rows:=int64(0)
|
||||
if err.GetError() == nil {
|
||||
rows, _ = res.RowsAffected()
|
||||
}
|
||||
|
||||
//如果更新成功,则删除缓存
|
||||
if rows!=0{
|
||||
if this.CacheIns!=nil{
|
||||
this.Cache(table+"*",nil)
|
||||
}
|
||||
}
|
||||
|
||||
//return 0
|
||||
rows, _ := res.RowsAffected()
|
||||
return rows
|
||||
}
|
||||
|
||||
@ -814,13 +840,19 @@ func (this *HoTimeDB) Delete(table string, data map[string]interface{}) int64 {
|
||||
query += temp
|
||||
|
||||
res, err := this.Exec(query, resWhere...)
|
||||
|
||||
if err.GetError() != nil {
|
||||
return 0
|
||||
rows:=int64(0)
|
||||
if err.GetError() == nil {
|
||||
rows, _ = res.RowsAffected()
|
||||
}
|
||||
|
||||
//如果删除成功,删除对应缓存
|
||||
if rows!=0{
|
||||
if this.CacheIns!=nil{
|
||||
this.Cache(table+"*",nil)
|
||||
}
|
||||
}
|
||||
//return 0
|
||||
rows, _ := res.RowsAffected()
|
||||
|
||||
return rows
|
||||
}
|
||||
|
||||
@ -849,16 +881,19 @@ func (this *HoTimeDB) Insert(table string, data map[string]interface{}) int64 {
|
||||
|
||||
res, err := this.Exec(query, values...)
|
||||
|
||||
if err.GetError() != nil {
|
||||
id:=int64(0)
|
||||
if err.GetError() == nil {
|
||||
id, this.LastErr.err = res.LastInsertId()
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
id, e := res.LastInsertId()
|
||||
this.LastErr.SetError(e)
|
||||
if e != nil {
|
||||
return 0
|
||||
//如果插入成功,删除缓存
|
||||
if id!=0{
|
||||
if this.CacheIns!=nil{
|
||||
this.Cache(table+"*",nil)
|
||||
}
|
||||
}
|
||||
|
||||
//fmt.Println(id)
|
||||
return id
|
||||
}
|
||||
|
@ -8,13 +8,12 @@ import (
|
||||
//"go.hoteas.com/hotime/cache"
|
||||
"golang.org/x/net/websocket"
|
||||
"time"
|
||||
"go.hoteas.com/hotime/cache"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
|
||||
|
||||
|
||||
appIns := hotime.Application{}
|
||||
|
||||
|
||||
@ -32,8 +31,14 @@ func main() {
|
||||
//手动模式,
|
||||
appIns.SetConfig("example/config/config.json")
|
||||
|
||||
|
||||
//redis缓存接入
|
||||
//ca:=hotime.CacheIns(&cache.CacheRedis{Host:appIns.Config.GetString("redisHost"),Pwd:appIns.Config.GetString("redisPwd"),Time:appIns.Config.GetCeilInt64("cacheLongTime")})
|
||||
//ca.Cache("xyzm","dasdas")
|
||||
//ca.Cache("xyzn","dasdas")
|
||||
//ca.Cache("xyzo","dasdas")
|
||||
//ca.Cache("xyz*",nil)
|
||||
//fmt.Println(ca.Cache("xyzm").Data)
|
||||
|
||||
|
||||
appIns.SetConnectDB(func(err ...*hotime.Error) *sql.DB {
|
||||
query := appIns.Config.GetString("dbUser") + ":" + appIns.Config.GetString("dbPwd") +
|
||||
|
8
obj.go
8
obj.go
@ -60,6 +60,14 @@ func (this *Obj) ToSlice(err ...Error) Slice {
|
||||
return ObjToSlice(this.Data, &this.Error)
|
||||
}
|
||||
|
||||
func (this *Obj)ToMapArray(err ...Error)[]Map{
|
||||
if len(err) != 0 {
|
||||
this.Error = err[0]
|
||||
}
|
||||
return ObjToMapArray(this.Data, &this.Error)
|
||||
}
|
||||
|
||||
|
||||
func (this *Obj) ToObj() interface{} {
|
||||
|
||||
return this.Data
|
||||
|
10
objtoobj.go
10
objtoobj.go
@ -49,6 +49,16 @@ func ObjToMap(obj interface{}, e ...*Error) Map {
|
||||
return v
|
||||
}
|
||||
|
||||
|
||||
func ObjToMapArray(obj interface{}, e ...*Error) []Map {
|
||||
s:=ObjToSlice(obj,e...)
|
||||
res:=[]Map{}
|
||||
for i:=0;i<len(s);i++{
|
||||
res=append(res,s.GetMap(i))
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
//仅限于hotime.Slice
|
||||
func ObjToSlice(obj interface{}, e ...*Error) Slice {
|
||||
var err error
|
||||
|
Loading…
Reference in New Issue
Block a user