Merge pull request #114 from JaminCui/master
add json tag lower camel case
This commit is contained in:
@@ -96,6 +96,11 @@ func GetIsWEBTag() bool {
|
|||||||
return _map.IsWEBTag
|
return _map.IsWEBTag
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetIsWEBTag json tag.json标记
|
||||||
|
func SetIsWEBTag(b bool) {
|
||||||
|
_map.IsWEBTag = b
|
||||||
|
}
|
||||||
|
|
||||||
// GetIsWebTagPkHidden web tag是否隐藏主键
|
// GetIsWebTagPkHidden web tag是否隐藏主键
|
||||||
func GetIsWebTagPkHidden() bool {
|
func GetIsWebTagPkHidden() bool {
|
||||||
return _map.IsWebTagPkHidden
|
return _map.IsWebTagPkHidden
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ func (m *_Model) genTableElement(cols []ColumnsInfo) (el []genstruct.GenElement)
|
|||||||
if isPK && config.GetIsWebTagPkHidden() {
|
if isPK && config.GetIsWebTagPkHidden() {
|
||||||
tmp.AddTag(_tagJSON, "-")
|
tmp.AddTag(_tagJSON, "-")
|
||||||
} else {
|
} else {
|
||||||
tmp.AddTag(_tagJSON, mybigcamel.UnMarshal(v.Name))
|
tmp.AddTag(_tagJSON, mybigcamel.UnSmallMarshal(mybigcamel.Marshal(v.Name)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@ func (m *_Model) genForeignKey(col ColumnsInfo) (fklist []genstruct.GenElement)
|
|||||||
|
|
||||||
// json tag
|
// json tag
|
||||||
if config.GetIsWEBTag() {
|
if config.GetIsWEBTag() {
|
||||||
tmp.AddTag(_tagJSON, mybigcamel.UnMarshal(v.TableName)+"_list")
|
tmp.AddTag(_tagJSON, mybigcamel.UnSmallMarshal(mybigcamel.Marshal(v.TableName))+"List")
|
||||||
}
|
}
|
||||||
|
|
||||||
fklist = append(fklist, tmp)
|
fklist = append(fklist, tmp)
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ package model
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/xxjwxc/gormt/data/config"
|
"github.com/xxjwxc/gormt/data/config"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTypeName(t *testing.T) {
|
func TestTypeName(t *testing.T) {
|
||||||
@@ -19,6 +18,8 @@ func TestTools(t *testing.T) {
|
|||||||
// out, _ := json.Marshal(pkg)
|
// out, _ := json.Marshal(pkg)
|
||||||
// tools.WriteFile("test.txt", []string{string(out)}, true)
|
// tools.WriteFile("test.txt", []string{string(out)}, true)
|
||||||
|
|
||||||
|
config.SetIsWEBTag(true)
|
||||||
|
config.SetIsOutFunc(false)
|
||||||
list, _ := Generate(pkg)
|
list, _ := Generate(pkg)
|
||||||
fmt.Println(list)
|
fmt.Println(list)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user