Skip to content

Commit

Permalink
comment
Browse files Browse the repository at this point in the history
  • Loading branch information
swxctx committed Dec 21, 2018
1 parent e7fa46a commit 43ae73d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 35 deletions.
1 change: 0 additions & 1 deletion format.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ func (xj *xjson) keyCase(str string) string {
upperStr += string(x[i])
continue
}

upperStr += string(x[i])
continue
}
Expand Down
35 changes: 1 addition & 34 deletions input.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
package main

import (
"encoding/json"
"fmt"
"os"
"reflect"

"github.com/usthooz/oozlog/go"
)

// readJsonToFile 从文件中读取json信息
Expand All @@ -25,37 +21,8 @@ func readJsonToFile(fileName string) string {
break
}
json = `` + string(buf[:len]) + ``
ck := New("json2go", json)
ck := new("Json2GoAutoGenerate", json)
ck.json2Struct()
}
return json
}

// json2Struct 完成json转换
func (xj *xjson) json2Struct() *xjson {
Xkeyv = Xkeyvori
if xj.JSONTag {
Xkeyv = Xkeyvtag
}
if err := json.Unmarshal([]byte(xj.Msg), &xj.Parent); err != nil {
ozlog.Errorf("parse json failed:", err)
return nil
}
xj.appendStr(fmt.Sprintf(Xbegin, xj.Name))
for k, v := range xj.Parent {
orik, k := xj.keyFilter(k)
tmptype := fmt.Sprintf(Xstr, reflect.TypeOf(v))
if tmptype == Xmap {
xj.subStruct(orik, v)
tmptype = k
}
if tmptype == Xlist {
xj.subList(orik, v)
tmptype = k
}
xj.appendStr(fmt.Sprintf(Xkeyv, k, tmptype, xj.MapTag[k]))
}
xj.printStruct()
xj.Flush()
return xj
}

0 comments on commit 43ae73d

Please sign in to comment.