forked from golang/hotime
管理端初步
This commit is contained in:
parent
cd242cc9d6
commit
1c2e7007df
@ -6,7 +6,8 @@
|
||||
<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$/example/main.go" afterPath="$PROJECT_DIR$/example/main.go" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/map.go" afterPath="$PROJECT_DIR$/map.go" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/slice.go" afterPath="$PROJECT_DIR$/slice.go" />
|
||||
</list>
|
||||
<ignored path=".idea/dataSources.local.xml" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
@ -25,43 +26,33 @@
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<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="306">
|
||||
<caret line="18" column="24" lean-forward="false" selection-start-line="18" selection-start-column="24" selection-end-line="18" selection-end-column="24" />
|
||||
<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">
|
||||
<state relative-caret-position="153">
|
||||
<caret line="9" column="13" lean-forward="false" selection-start-line="9" selection-start-column="4" selection-end-line="9" selection-end-column="13" />
|
||||
<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="303">
|
||||
<caret line="43" column="0" lean-forward="true" selection-start-line="43" selection-start-column="0" selection-end-line="43" selection-end-column="0" />
|
||||
<state relative-caret-position="315">
|
||||
<caret line="49" column="0" lean-forward="false" selection-start-line="49" selection-start-column="0" selection-end-line="58" selection-end-column="1" />
|
||||
<folding>
|
||||
<element signature="e#16#64#0" expanded="true" />
|
||||
<element signature="e#16#72#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="main.go" pinned="false" current-in-tab="true">
|
||||
<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="15" lean-forward="false" selection-start-line="5" selection-start-column="15" selection-end-line="5" selection-end-column="15" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<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="17" column="11" lean-forward="true" selection-start-line="17" selection-start-column="11" selection-end-line="17" selection-end-column="11" />
|
||||
<state relative-caret-position="1210">
|
||||
<caret line="85" column="0" lean-forward="true" selection-start-line="85" selection-start-column="0" selection-end-line="85" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="e#14#137#0" expanded="true" />
|
||||
</folding>
|
||||
@ -109,6 +100,18 @@
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="slice.go" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/slice.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="272">
|
||||
<caret line="16" column="0" lean-forward="true" selection-start-line="16" selection-start-column="0" selection-end-line="16" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="e#16#53#0" expanded="true" />
|
||||
</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">
|
||||
@ -154,7 +157,6 @@
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/slice.go" />
|
||||
<option value="$PROJECT_DIR$/objtoobj.go" />
|
||||
<option value="$PROJECT_DIR$/controller.go" />
|
||||
<option value="$PROJECT_DIR$/Config.go" />
|
||||
@ -182,8 +184,9 @@
|
||||
<option value="$PROJECT_DIR$/error.go" />
|
||||
<option value="$PROJECT_DIR$/const.go" />
|
||||
<option value="$PROJECT_DIR$/session.go" />
|
||||
<option value="$PROJECT_DIR$/map.go" />
|
||||
<option value="$PROJECT_DIR$/example/main.go" />
|
||||
<option value="$PROJECT_DIR$/map.go" />
|
||||
<option value="$PROJECT_DIR$/slice.go" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
@ -449,7 +452,7 @@
|
||||
<workItem from="1504252839700" duration="18000" />
|
||||
<workItem from="1504488004086" duration="365000" />
|
||||
<workItem from="1504488391347" duration="840000" />
|
||||
<workItem from="1504575702799" duration="5238000" />
|
||||
<workItem from="1504575702799" duration="8135000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001">
|
||||
<created>1500458878821</created>
|
||||
@ -612,11 +615,18 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1504580135666</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="24" />
|
||||
<task id="LOCAL-00024" summary="管理端初步">
|
||||
<created>1504580975118</created>
|
||||
<option name="number" value="00024" />
|
||||
<option name="presentableId" value="LOCAL-00024" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1504580975118</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="25" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="82776000" />
|
||||
<option name="totallyTimeSpent" value="85673000" />
|
||||
</component>
|
||||
<component name="TodoView">
|
||||
<todo-panel id="selected-file">
|
||||
@ -807,13 +817,6 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/obj.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="85">
|
||||
<caret line="5" column="15" lean-forward="false" selection-start-line="5" selection-start-column="15" selection-end-line="5" selection-end-column="15" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/application.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="102">
|
||||
@ -828,13 +831,6 @@
|
||||
</state>
|
||||
</provider>
|
||||
</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" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://D:/app/go/src/runtime/hashmap.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="4199">
|
||||
@ -944,19 +940,11 @@
|
||||
<state relative-caret-position="289">
|
||||
<caret line="18" column="1" lean-forward="true" selection-start-line="18" selection-start-column="1" selection-end-line="18" selection-end-column="1" />
|
||||
<folding>
|
||||
<marker date="1504580163801" expanded="true" signature="201:235" ph="[...]" />
|
||||
<marker date="1504580963456" expanded="true" signature="201:235" ph="[...]" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/context_base.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="153">
|
||||
<caret line="9" column="0" lean-forward="false" selection-start-line="9" selection-start-column="0" selection-end-line="16" selection-end-column="1" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/var.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="306">
|
||||
@ -973,14 +961,6 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/session.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="969">
|
||||
<caret line="57" column="13" lean-forward="false" selection-start-line="57" selection-start-column="13" selection-end-line="57" selection-end-column="13" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/cache_memory.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="816">
|
||||
@ -1005,6 +985,42 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/main.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1210">
|
||||
<caret line="85" column="0" lean-forward="true" selection-start-line="85" selection-start-column="0" selection-end-line="85" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="e#14#137#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/context_base.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="153">
|
||||
<caret line="9" column="0" lean-forward="false" selection-start-line="9" selection-start-column="0" selection-end-line="16" selection-end-column="1" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/map.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="315">
|
||||
<caret line="49" column="0" lean-forward="false" selection-start-line="49" selection-start-column="0" selection-end-line="58" selection-end-column="1" />
|
||||
<folding>
|
||||
<element signature="e#16#72#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/obj.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="85">
|
||||
<caret line="5" column="15" lean-forward="false" selection-start-line="5" selection-start-column="15" selection-end-line="5" 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="493">
|
||||
@ -1013,22 +1029,20 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/map.go">
|
||||
<entry file="file://$PROJECT_DIR$/session.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="303">
|
||||
<caret line="43" column="0" lean-forward="true" selection-start-line="43" selection-start-column="0" selection-end-line="43" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="e#16#64#0" expanded="true" />
|
||||
</folding>
|
||||
<state relative-caret-position="969">
|
||||
<caret line="57" column="13" lean-forward="false" selection-start-line="57" selection-start-column="13" selection-end-line="57" selection-end-column="13" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/main.go">
|
||||
<entry file="file://$PROJECT_DIR$/slice.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="289">
|
||||
<caret line="17" column="11" lean-forward="true" selection-start-line="17" selection-start-column="11" selection-end-line="17" selection-end-column="11" />
|
||||
<state relative-caret-position="272">
|
||||
<caret line="16" column="0" lean-forward="true" selection-start-line="16" selection-start-column="0" selection-end-line="16" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="e#14#137#0" expanded="true" />
|
||||
<element signature="e#16#53#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
|
12
map.go
12
map.go
@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"reflect"
|
||||
"time"
|
||||
)
|
||||
|
||||
//hotime的常用map
|
||||
@ -46,6 +47,17 @@ func (this Map) GetInt(key string, err ...*Error) int {
|
||||
|
||||
}
|
||||
|
||||
// //唯一标志
|
||||
func (this Map) GetTag() int64 {
|
||||
|
||||
res := this.GetInt64(MUTEX_MAP)
|
||||
if res == int64(0) {
|
||||
res = time.Now().UnixNano()
|
||||
this.Put(MUTEX_MAP, res)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
//获取Int
|
||||
func (this Map) GetInt64(key string, err ...*Error) int64 {
|
||||
v := ObjToInt64((this)[key], err...)
|
||||
|
54
slice.go
54
slice.go
@ -1,80 +1,78 @@
|
||||
package hotime
|
||||
|
||||
import ("encoding/json"
|
||||
"errors")
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
)
|
||||
|
||||
type Slice []interface{}
|
||||
|
||||
//获取string
|
||||
func (this Slice) GetString(key int,err... *Error) string {
|
||||
if(len(err)!=0){
|
||||
func (this Slice) GetString(key int, err ...*Error) string {
|
||||
if len(err) != 0 {
|
||||
err[0].SetError(nil)
|
||||
}
|
||||
return ObjToStr((this)[key])
|
||||
}
|
||||
|
||||
//获取Int
|
||||
func (this Slice) GetInt(key int,err... *Error) int {
|
||||
v := ObjToInt((this)[key],err...)
|
||||
func (this Slice) GetInt(key int, err ...*Error) int {
|
||||
v := ObjToInt((this)[key], err...)
|
||||
return v
|
||||
}
|
||||
|
||||
//获取Int
|
||||
func (this Slice) GetInt64(key int,err... *Error) int64 {
|
||||
v:= ObjToInt64((this)[key],err...)
|
||||
func (this Slice) GetInt64(key int, err ...*Error) int64 {
|
||||
v := ObjToInt64((this)[key], err...)
|
||||
|
||||
return v
|
||||
}
|
||||
|
||||
//获取Float64
|
||||
func (this Slice) GetFloat64(key int,err... *Error) (float64) {
|
||||
v:= ObjToFloat64((this)[key],err...)
|
||||
func (this Slice) GetFloat64(key int, err ...*Error) float64 {
|
||||
v := ObjToFloat64((this)[key], err...)
|
||||
|
||||
return v
|
||||
}
|
||||
|
||||
func (this Slice) GetSlice(key int,err... *Error) Slice {
|
||||
v := ObjToSlice((this)[key],err...)
|
||||
func (this Slice) GetSlice(key int, err ...*Error) Slice {
|
||||
v := ObjToSlice((this)[key], err...)
|
||||
return v
|
||||
}
|
||||
|
||||
|
||||
func (this Slice) GetMap(key int,err... *Error) Map {
|
||||
func (this Slice) GetMap(key int, err ...*Error) Map {
|
||||
//var v Map
|
||||
v:= ObjToMap((this)[key],err...)
|
||||
v := ObjToMap((this)[key], err...)
|
||||
return v
|
||||
}
|
||||
|
||||
func (this Slice) Get(key int, err ...*Error) interface{} {
|
||||
|
||||
|
||||
func (this Slice) Get(key int,err... *Error) interface{} {
|
||||
|
||||
if(key<len(this)){
|
||||
if key < len(this) {
|
||||
return this[key]
|
||||
}
|
||||
e:=errors.New("没有存储key及对应的数据")
|
||||
if(len(err)!=0){
|
||||
e := errors.New("没有存储key及对应的数据")
|
||||
if len(err) != 0 {
|
||||
err[0].SetError(e)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this Slice)Put(key int,value interface{}){
|
||||
this[key]=value
|
||||
func (this Slice) Put(key int, value interface{}) {
|
||||
this[key] = value
|
||||
}
|
||||
func (this Slice)Append(value interface{}){
|
||||
func (this Slice) Append(value interface{}) {
|
||||
|
||||
this=append(this,value)
|
||||
this = append(this, value)
|
||||
|
||||
}
|
||||
|
||||
|
||||
func (this Slice) GetJsonString() string {
|
||||
return ObjToStr(this)
|
||||
}
|
||||
|
||||
func (this Slice)JsonToSlice(jsonStr string){
|
||||
func (this Slice) JsonToSlice(jsonStr string) {
|
||||
|
||||
json.Unmarshal([]byte(jsonStr),&this)
|
||||
json.Unmarshal([]byte(jsonStr), &this)
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user