add sql statements output ,change defalt config info
This commit is contained in:
@@ -112,7 +112,7 @@ type UserAccountTbl struct {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### [更多>>>](doc/export.md)
|
### [more>>>](doc/export.md)
|
||||||
|
|
||||||
## 6. build
|
## 6. build
|
||||||
```
|
```
|
||||||
|
|||||||
13
config.yml
13
config.yml
@@ -1,14 +1,9 @@
|
|||||||
base :
|
|
||||||
serial_number : "1.0" #版本号
|
|
||||||
service_name : #服务名
|
|
||||||
service_displayname : #服务显示名
|
|
||||||
sercice_desc : #服务描述
|
|
||||||
is_dev : false # 是否开发者模式
|
|
||||||
out_dir : ./model # 输出目录
|
out_dir : ./model # 输出目录
|
||||||
singular_table : false # 单表模式:true:禁用表名复数,false:采用表明复数 参考:gorm.SingularTable
|
singular_table : false # 单表模式:true:禁用表名复数,false:采用表明复数 参考:gorm.SingularTable
|
||||||
simple : true #简单输出
|
simple : false # 简单输出(默认gorm标签不输出)
|
||||||
is_json_tag : false #是否打json标记
|
is_out_sql : false # 是否输出 sql 原信息
|
||||||
is_foreign_key : true #是否导出外键关联
|
is_json_tag : true # 是否打json标记
|
||||||
|
is_foreign_key : true # 是否导出外键关联
|
||||||
mysql_info:
|
mysql_info:
|
||||||
host : 127.0.0.1
|
host : 127.0.0.1
|
||||||
port : 3306
|
port : 3306
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ type Config struct {
|
|||||||
IsJSONTag bool `yaml:"is_json_tag"`
|
IsJSONTag bool `yaml:"is_json_tag"`
|
||||||
SingularTable bool `yaml:"singular_table"`
|
SingularTable bool `yaml:"singular_table"`
|
||||||
IsForeignKey bool `yaml:"is_foreign_key"`
|
IsForeignKey bool `yaml:"is_foreign_key"`
|
||||||
|
IsOutSQL bool `yaml:"is_out_sql"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MysqlDbInfo mysql database information. mysql 数据库信息
|
// MysqlDbInfo mysql database information. mysql 数据库信息
|
||||||
@@ -82,3 +83,8 @@ func GetIsForeignKey() bool {
|
|||||||
func SetForeignKey(b bool) {
|
func SetForeignKey(b bool) {
|
||||||
_map.IsForeignKey = b
|
_map.IsForeignKey = b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetIsOutSQL if is output sql .
|
||||||
|
func GetIsOutSQL() bool {
|
||||||
|
return _map.IsOutSQL
|
||||||
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ func (s *GenStruct) AddElement(e ...GenElement) {
|
|||||||
// Generates Get the result data.获取结果数据
|
// Generates Get the result data.获取结果数据
|
||||||
func (s *GenStruct) Generates() []string {
|
func (s *GenStruct) Generates() []string {
|
||||||
var p generate.PrintAtom
|
var p generate.PrintAtom
|
||||||
if !config.GetSimple() {
|
if config.GetIsOutSQL() {
|
||||||
p.Add("/******sql******")
|
p.Add("/******sql******")
|
||||||
p.Add(s.SQLBuildStr)
|
p.Add(s.SQLBuildStr)
|
||||||
p.Add("******sql******/")
|
p.Add("******sql******/")
|
||||||
|
|||||||
Reference in New Issue
Block a user