forked from golang/hotime
工具
This commit is contained in:
parent
0e935832d3
commit
8a911ac2c7
@ -1,17 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="GOPATH <hotime>">
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/../../golang.org" />
|
||||
<root url="file://$PROJECT_DIR$/../../github.com" />
|
||||
<root url="file://$PROJECT_DIR$/.." />
|
||||
</CLASSES>
|
||||
<SOURCES>
|
||||
<root url="file://$PROJECT_DIR$/../../golang.org" />
|
||||
<root url="file://$PROJECT_DIR$/../../github.com" />
|
||||
<root url="file://$PROJECT_DIR$/.." />
|
||||
</SOURCES>
|
||||
<excluded>
|
||||
<root url="file://$PROJECT_DIR$" />
|
||||
</excluded>
|
||||
</library>
|
||||
</component>
|
@ -5,7 +5,12 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" readonly="true" id="03ed5703-81a1-441b-849c-c426276586b7" name="Default" comment="">
|
||||
<change type="DELETED" beforePath="$PROJECT_DIR$/.idea/libraries/GOPATH__hotime_.xml" afterPath="" />
|
||||
<change type="DELETED" beforePath="$PROJECT_DIR$/.idea/libraries" afterPath="" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/application.go" afterPath="$PROJECT_DIR$/application.go" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/objtoobj.go" afterPath="$PROJECT_DIR$/objtoobj.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" />
|
||||
@ -18,7 +23,6 @@
|
||||
<component name="CreatePatchCommitExecutor">
|
||||
<option name="PATCH_PATH" value="" />
|
||||
</component>
|
||||
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
|
||||
<component name="FavoritesManager">
|
||||
<favorites_list name="hotime" />
|
||||
</component>
|
||||
@ -101,7 +105,7 @@
|
||||
<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="2703">
|
||||
<state relative-caret-position="2686">
|
||||
<caret line="163" column="20" lean-forward="false" selection-start-line="163" selection-start-column="20" selection-end-line="163" selection-end-column="20" />
|
||||
<folding />
|
||||
</state>
|
||||
@ -220,58 +224,19 @@
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="Scope" />
|
||||
<pane id="Scratches" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="hotime" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="hotime" />
|
||||
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="hotime" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="hotime" />
|
||||
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="dri" />
|
||||
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="upload" />
|
||||
<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="dri" />
|
||||
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="ddsms" />
|
||||
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="hotime" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="hotime" type="2a2b976b:PhpTreeStructureProvider$1" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scratches" />
|
||||
<pane id="Scope" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
@ -307,33 +272,21 @@
|
||||
</option>
|
||||
</component>
|
||||
<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">
|
||||
<configuration 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" />
|
||||
<filePath value="$PROJECT_DIR$/example/main.go" />
|
||||
<package value="hoteas/hotime" />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="CodeceptionConfigurationType" factoryName="Codeception">
|
||||
<PhpTestRunnerSettings />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="GoApplicationRunConfiguration" factoryName="Go Application">
|
||||
<module name="hotime" />
|
||||
<working_directory value="$PROJECT_DIR$/" />
|
||||
<go_parameters value="-i" />
|
||||
<filePath value="$PROJECT_DIR$/" />
|
||||
<kind value="FILE" />
|
||||
<package value="hoteas/hotime" />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="GoRunFileConfiguration" factoryName="Go Single File">
|
||||
<module name="hotime" />
|
||||
<working_directory value="$PROJECT_DIR$/" />
|
||||
<filePath value="$PROJECT_DIR$/" />
|
||||
<method />
|
||||
<package value="hoteas/hotime" />
|
||||
</configuration>
|
||||
<configuration default="true" type="GoTestRunConfiguration" factoryName="Go Test">
|
||||
<module name="hotime" />
|
||||
@ -342,6 +295,23 @@
|
||||
<framework value="gotest" />
|
||||
<kind value="DIRECTORY" />
|
||||
<package value="hoteas/hotime" />
|
||||
</configuration>
|
||||
<configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
|
||||
<node-interpreter>project</node-interpreter>
|
||||
<node-options />
|
||||
<gulpfile />
|
||||
<tasks />
|
||||
<arguments />
|
||||
<envs />
|
||||
</configuration>
|
||||
<configuration default="true" type="CodeceptionConfigurationType" factoryName="Codeception">
|
||||
<PhpTestRunnerSettings />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="GoRunFileConfiguration" factoryName="Go Single File">
|
||||
<module name="hotime" />
|
||||
<working_directory value="$PROJECT_DIR$/" />
|
||||
<filePath value="$PROJECT_DIR$/" />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="JavaScriptTestRunnerJest" factoryName="Jest">
|
||||
@ -378,15 +348,6 @@
|
||||
<PhpTestRunnerSettings />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
|
||||
<node-interpreter>project</node-interpreter>
|
||||
<node-options />
|
||||
<gulpfile />
|
||||
<tasks />
|
||||
<arguments />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="js.build_tools.npm" factoryName="npm">
|
||||
<command value="run" />
|
||||
<scripts />
|
||||
@ -407,9 +368,6 @@
|
||||
<recursive>false</recursive>
|
||||
<method />
|
||||
</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" />
|
||||
@ -476,6 +434,7 @@
|
||||
<workItem from="1504488391347" duration="840000" />
|
||||
<workItem from="1504575702799" duration="11303000" />
|
||||
<workItem from="1504661068799" duration="698000" />
|
||||
<workItem from="1508808650888" duration="41000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001">
|
||||
<created>1500458878821</created>
|
||||
@ -663,7 +622,7 @@
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="89539000" />
|
||||
<option name="totallyTimeSpent" value="89580000" />
|
||||
</component>
|
||||
<component name="TodoView">
|
||||
<todo-panel id="selected-file">
|
||||
@ -677,16 +636,16 @@
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="55" y="-8" width="1873" height="1084" extended-state="0" />
|
||||
<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.34142306" 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.34528404" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32846716" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.6330179" 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.32912722" 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.6330179" sideWeight="0.5" order="7" 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="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="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" />
|
||||
@ -701,7 +660,7 @@
|
||||
</layout>
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="processedProjectFiles" value="true" />
|
||||
<option name="version" value="1" />
|
||||
</component>
|
||||
<component name="VcsContentAnnotationSettings">
|
||||
<option name="myLimit" value="2678400000" />
|
||||
@ -919,7 +878,6 @@
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="102">
|
||||
<caret line="6" column="0" lean-forward="false" selection-start-line="6" selection-start-column="0" selection-end-line="6" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -990,7 +948,7 @@
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/objtoobj.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="2703">
|
||||
<state relative-caret-position="2686">
|
||||
<caret line="163" column="20" lean-forward="false" selection-start-line="163" selection-start-column="20" selection-end-line="163" selection-end-column="20" />
|
||||
<folding />
|
||||
</state>
|
||||
|
@ -33,7 +33,7 @@ func (this *Application) Run(router Router) {
|
||||
//this.Port = port
|
||||
this.Port = this.Config.GetString("port")
|
||||
|
||||
if this.connectDbFunc != nil {
|
||||
if this.connectDbFunc != nil && this.Db.DB.Ping() != nil {
|
||||
this.Db.SetConnect(this.connectDbFunc)
|
||||
}
|
||||
|
||||
@ -57,6 +57,7 @@ func (this *Application) Run(router Router) {
|
||||
//启动实例
|
||||
func (this *Application) SetConnectDB(connect func(err ...*Error) *sql.DB) {
|
||||
this.connectDbFunc = connect
|
||||
this.Db.SetConnect(this.connectDbFunc)
|
||||
}
|
||||
|
||||
//设置配置文件路径全路径或者相对路径
|
||||
@ -70,6 +71,10 @@ func (this *Application) SetSession(short CacheIns, Long CacheIns) {
|
||||
func (this *Application) SetDefault(connect func(err ...*Error) *sql.DB) {
|
||||
this.SetConfig()
|
||||
this.connectDbFunc = connect
|
||||
if this.connectDbFunc!=nil{
|
||||
this.Db.SetConnect(this.connectDbFunc)
|
||||
}
|
||||
|
||||
//防止手动设置缓存误伤
|
||||
if this.CacheIns == nil {
|
||||
this.SetCache(CacheIns(&CacheMemory{}))
|
||||
|
63
objtoobj.go
63
objtoobj.go
@ -1,13 +1,14 @@
|
||||
package hotime
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strconv"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
)
|
||||
|
||||
//仅限于hotime.Slice
|
||||
func ObjToMap(obj interface{},e... *Error) Map {
|
||||
func ObjToMap(obj interface{}, e ...*Error) Map {
|
||||
var err error
|
||||
var v Map
|
||||
|
||||
@ -15,22 +16,24 @@ func ObjToMap(obj interface{},e... *Error) Map {
|
||||
v = nil
|
||||
err = errors.New("没有合适的转换对象!")
|
||||
} else {
|
||||
switch obj.(type){
|
||||
case Map:v = obj.(Map)
|
||||
case map[string]interface {}:v=obj.(map[string]interface{})
|
||||
switch obj.(type) {
|
||||
case Map:
|
||||
v = obj.(Map)
|
||||
case map[string]interface{}:
|
||||
v = obj.(map[string]interface{})
|
||||
default:
|
||||
v = nil
|
||||
err = errors.New("没有合适的转换对象!")
|
||||
}
|
||||
}
|
||||
if(len(e)!=0){
|
||||
if len(e) != 0 {
|
||||
e[0].SetError(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
//仅限于hotime.Slice
|
||||
func ObjToSlice(obj interface{},e... *Error) Slice{
|
||||
func ObjToSlice(obj interface{}, e ...*Error) Slice {
|
||||
var err error
|
||||
var v Slice
|
||||
|
||||
@ -41,21 +44,22 @@ func ObjToSlice(obj interface{},e... *Error) Slice{
|
||||
switch obj.(type) {
|
||||
case Slice:
|
||||
v = obj.(Slice)
|
||||
case []interface {}:v=obj.([]interface{})
|
||||
case []interface{}:
|
||||
v = obj.([]interface{})
|
||||
default:
|
||||
v = nil
|
||||
err = errors.New("没有合适的转换对象!")
|
||||
}
|
||||
}
|
||||
|
||||
if(len(e)!=0){
|
||||
if len(e) != 0 {
|
||||
e[0].SetError(err)
|
||||
}
|
||||
|
||||
return v
|
||||
}
|
||||
|
||||
func ObjToFloat64(obj interface{},e... *Error) float64 {
|
||||
func ObjToFloat64(obj interface{}, e ...*Error) float64 {
|
||||
var err error
|
||||
v := float64(0)
|
||||
|
||||
@ -94,13 +98,13 @@ func ObjToFloat64(obj interface{},e... *Error) float64 {
|
||||
err = errors.New("没有合适的转换对象!")
|
||||
}
|
||||
}
|
||||
if(len(e)!=0){
|
||||
if len(e) != 0 {
|
||||
e[0].SetError(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
func ObjToInt64(obj interface{},e... *Error) int64 {
|
||||
func ObjToInt64(obj interface{}, e ...*Error) int64 {
|
||||
var err error
|
||||
v := int64(0)
|
||||
|
||||
@ -138,13 +142,13 @@ func ObjToInt64(obj interface{},e... *Error) int64 {
|
||||
err = errors.New("没有合适的转换对象!")
|
||||
}
|
||||
}
|
||||
if(len(e)!=0){
|
||||
if len(e) != 0 {
|
||||
e[0].SetError(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
func ObjToInt(obj interface{},e... *Error) int {
|
||||
func ObjToInt(obj interface{}, e ...*Error) int {
|
||||
var err error
|
||||
v := 0
|
||||
if obj == nil {
|
||||
@ -182,7 +186,7 @@ func ObjToInt(obj interface{},e... *Error) int {
|
||||
|
||||
}
|
||||
}
|
||||
if(len(e)!=0){
|
||||
if len(e) != 0 {
|
||||
e[0].SetError(err)
|
||||
}
|
||||
return v
|
||||
@ -191,7 +195,7 @@ func ObjToInt(obj interface{},e... *Error) int {
|
||||
func ObjToStr(obj interface{}) string {
|
||||
// fmt.Println(reflect.ValueOf(obj).Type().String() )
|
||||
str := ""
|
||||
if obj==nil{
|
||||
if obj == nil {
|
||||
return str
|
||||
}
|
||||
switch obj.(type) {
|
||||
@ -208,9 +212,9 @@ func ObjToStr(obj interface{}) string {
|
||||
case float64:
|
||||
str = strconv.FormatFloat(obj.(float64), 'f', 6, 64)
|
||||
default:
|
||||
strbte,err:=json.Marshal(obj);
|
||||
if err==nil{
|
||||
str=string(strbte)
|
||||
strbte, err := json.Marshal(obj)
|
||||
if err == nil {
|
||||
str = string(strbte)
|
||||
}
|
||||
|
||||
}
|
||||
@ -218,6 +222,27 @@ func ObjToStr(obj interface{}) string {
|
||||
return str
|
||||
}
|
||||
|
||||
//字符串数组: a1,a2,a3转["a1","a2","a3"]
|
||||
func StrArrayToJsonStr(a string) string {
|
||||
if len(a) != 0 {
|
||||
a = strings.Replace(a, ",", `","`, -1)
|
||||
a = `["` + a + `"]`
|
||||
} else {
|
||||
a = "[]"
|
||||
}
|
||||
return a
|
||||
}
|
||||
|
||||
//字符串数组: a1,a2,a3转["a1","a2","a3"]
|
||||
func JsonStrToStrArray(a string) string {
|
||||
a = strings.Replace(a, `"`, "", -1)
|
||||
if len(a)!=0{
|
||||
a = Substr(a, 1, len(a)-2)
|
||||
}
|
||||
|
||||
return a
|
||||
}
|
||||
|
||||
//字符串转int
|
||||
func StrToInt(s string) (int, error) {
|
||||
i, err := strconv.Atoi(s)
|
||||
|
4
slice.go
4
slice.go
@ -62,10 +62,12 @@ func (this Slice) Put(key int, value interface{}) {
|
||||
this[key] = value
|
||||
}
|
||||
|
||||
func (this Slice) GetJsonString() string {
|
||||
func (this Slice) ToJsonString() string {
|
||||
return ObjToStr(this)
|
||||
}
|
||||
|
||||
|
||||
|
||||
func (this Slice) JsonToSlice(jsonStr string) {
|
||||
|
||||
json.Unmarshal([]byte(jsonStr), &this)
|
||||
|
Loading…
Reference in New Issue
Block a user