add gui support

添加 ui 支持
This commit is contained in:
谢小军
2020-01-21 00:41:16 +08:00
parent 530ef778f7
commit b72a40e40e
15 changed files with 658 additions and 2 deletions

View File

@@ -1,18 +1,24 @@
package config
import "fmt"
import (
"fmt"
)
// Config custom config struct
type Config struct {
CfgBase `yaml:"base"`
MySQLInfo MysqlDbInfo `yaml:"mysql_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
Simple bool `yaml:"simple"`
IsJSONTag bool `yaml:"is_json_tag"`
SingularTable bool `yaml:"singular_table"`
IsForeignKey bool `yaml:"is_foreign_key"`
IsOutSQL bool `yaml:"is_out_sql"`
IsOutFunc bool `yaml:"is_out_func"`
IsGUI bool `yaml:"is_gui"` //
}
// MysqlDbInfo mysql database information. mysql 数据库信息
@@ -99,3 +105,55 @@ func GetIsOutFunc() bool {
func SetIsOutFunc(b bool) {
_map.IsOutFunc = b
}
// GetIsGUI if is gui show .
func GetIsGUI() bool {
return _map.IsGUI
}
// SetIsGUI if is gui show .
func SetIsGUI(b bool) {
_map.IsGUI = b
}
// GetURLTag get url tag.
func GetURLTag() string {
if _map.URLTag != "json" && _map.URLTag != "url" {
_map.URLTag = "json"
}
return _map.URLTag
}
// SetURLTag set url tag.
func SetURLTag(s string) {
_map.URLTag = s
}
// GetLG get language tag.
func GetLG() string {
if _map.Language != "English" && _map.Language != "中 文" {
_map.Language = "English"
}
return _map.Language
}
// SetLG set url tag.
func SetLG(s string) {
_map.Language = s
}
// GetDBTag get database tag.
func GetDBTag() string {
if _map.DbTag != "gorm" && _map.DbTag != "db" {
_map.DbTag = "gorm"
}
return _map.DbTag
}
// SetDBTag get database tag.
func SetDBTag(s string) {
_map.DbTag = s
}

View File

@@ -55,3 +55,13 @@ func GetServiceConfig() (name, displayName, desc string) {
desc = _map.SerciceDesc
return
}
// GetIsDev is is dev
func GetIsDev() bool {
return _map.IsDev
}
// SetIsDev is is dev
func SetIsDev(b bool) {
_map.IsDev = b
}