add sql statements output ,change defalt config info

This commit is contained in:
谢小军
2019-11-22 11:37:51 +08:00
parent 9617450e6b
commit 326b6b419a
4 changed files with 12 additions and 11 deletions

View File

@@ -11,6 +11,7 @@ type Config struct {
IsJSONTag bool `yaml:"is_json_tag"`
SingularTable bool `yaml:"singular_table"`
IsForeignKey bool `yaml:"is_foreign_key"`
IsOutSQL bool `yaml:"is_out_sql"`
}
// MysqlDbInfo mysql database information. mysql 数据库信息
@@ -82,3 +83,8 @@ func GetIsForeignKey() bool {
func SetForeignKey(b bool) {
_map.IsForeignKey = b
}
// GetIsOutSQL if is output sql .
func GetIsOutSQL() bool {
return _map.IsOutSQL
}

View File

@@ -99,7 +99,7 @@ func (s *GenStruct) AddElement(e ...GenElement) {
// Generates Get the result data.获取结果数据
func (s *GenStruct) Generates() []string {
var p generate.PrintAtom
if !config.GetSimple() {
if config.GetIsOutSQL() {
p.Add("/******sql******")
p.Add(s.SQLBuildStr)
p.Add("******sql******/")