Merge pull request #179 from redbirdztc/feature-use-gorm-model-or-not
feature: model是否使用gorm.Model
This commit is contained in:
@@ -5,6 +5,7 @@ url_tag : json # web url tag(json,db(https://github.com/google/go-querystring))
|
||||
language : # 语言(English,中 文)
|
||||
db_tag : gorm # 数据库标签名(gorm,db)
|
||||
simple : true # 简单输出(默认只输出gorm主键和字段标签)
|
||||
use_gorm_model : false # model是否使用gorm.Model
|
||||
is_db_tag : true # 是否输出 数据库标签(gorm,db)
|
||||
is_out_sql : false # 是否输出 sql 原信息
|
||||
is_out_func : true # 是否输出 快捷函数
|
||||
|
||||
@@ -12,9 +12,10 @@ type Config struct {
|
||||
CfgBase `yaml:"base"`
|
||||
DBInfo DBInfo `yaml:"db_info"`
|
||||
OutDir string `yaml:"out_dir"`
|
||||
URLTag string `yaml:"url_tag"` // url tag
|
||||
Language string `yaml:"language"` // language
|
||||
DbTag string `yaml:"db_tag"` // 数据库标签(gormt,db)
|
||||
URLTag string `yaml:"url_tag"` // url tag
|
||||
Language string `yaml:"language"` // language
|
||||
DbTag string `yaml:"db_tag"` // 数据库标签(gormt,db)
|
||||
UserGormModel bool `yaml:"user_gorm_model"` //model是否使用gorm.Model
|
||||
Simple bool `yaml:"simple"`
|
||||
IsWEBTag bool `yaml:"is_web_tag"`
|
||||
IsWebTagPkHidden bool `yaml:"is_web_tag_pk_hidden"` // web标记是否隐藏主键
|
||||
@@ -209,6 +210,11 @@ func SetDBTag(s string) {
|
||||
_map.DbTag = s
|
||||
}
|
||||
|
||||
// GetUserGormModel get `use gorm.Model or not`.
|
||||
func GetUserGormModel() bool {
|
||||
return _map.UserGormModel
|
||||
}
|
||||
|
||||
// SetIsNullToPoint if with null to porint in struct
|
||||
func SetIsNullToPoint(b bool) {
|
||||
_map.IsNullToPoint = b
|
||||
|
||||
@@ -32,12 +32,13 @@ var _map = Config{
|
||||
Password: "root",
|
||||
Database: "test",
|
||||
},
|
||||
OutDir: "./model",
|
||||
URLTag: "json",
|
||||
Language: "中 文",
|
||||
DbTag: "gorm",
|
||||
Simple: false,
|
||||
IsWEBTag: false,
|
||||
OutDir: "./model",
|
||||
URLTag: "json",
|
||||
Language: "中 文",
|
||||
DbTag: "gorm",
|
||||
UserGormModel: false,
|
||||
Simple: false,
|
||||
IsWEBTag: false,
|
||||
// SingularTable: true,
|
||||
IsForeignKey: true,
|
||||
IsOutSQL: false,
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
// filterModel filter.过滤 gorm.Model
|
||||
func filterModel(list *[]genColumns) bool {
|
||||
if config.GetDBTag() != "gorm" {
|
||||
if config.GetDBTag() != "gorm" || !config.GetUserGormModel() {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
// filterModel filter.过滤 gorm.Model
|
||||
func filterModel(list *[]genColumns) bool {
|
||||
if config.GetDBTag() != "gorm" {
|
||||
if config.GetDBTag() != "gorm" || !config.GetUserGormModel() {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
// filterModel filter.过滤 gorm.Model
|
||||
func filterModel(list *[]genColumns) bool {
|
||||
if config.GetDBTag() != "gorm" {
|
||||
if config.GetDBTag() != "gorm" || !config.GetUserGormModel() {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user