config

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Map = Config{
	CfgBase: CfgBase{
		IsDev: false,
	},
	Database: DBInfo{
		Host:     "127.0.0.1",
		Port:     3306,
		Username: "root",
		Password: "root",
		Database: "test",
	},
	OutDir:   "./model",
	URLTag:   "json",
	Language: "中 文",
	DbTag:    "gorm",
	Simple:   false,
	IsWEBTag: false,

	IsForeignKey:         true,
	IsOutSQL:             false,
	IsOutFunc:            false,
	IsGUI:                false,
	TablePrefix:          "",
	SelfTypeDef:          make(map[string]string),
	WebTagType:           0,
	TableNames:           "",
	IsColumnName:         false,
	IsOutFileByTableName: false,
}

Functions

func GetDBTag

func GetDBTag() string

GetDBTag get database tag.

func GetIsColumnName

func GetIsColumnName() bool

GetIsColumnName get gen columnName config . 获取生成列名的config

func GetIsDev

func GetIsDev() bool

GetIsDev is is dev

func GetIsForeignKey

func GetIsForeignKey() bool

GetIsForeignKey if is foreign key

func GetIsGUI

func GetIsGUI() bool

GetIsGUI if is gui show .

func GetIsNullToPoint

func GetIsNullToPoint() bool

GetIsNullToPoint get if with null to porint in sturct

func GetIsOutFileByTableName

func GetIsOutFileByTableName() bool

GetIsOutFileByTableName get gen columnName config . 设置是否根据表名生成文件

func GetIsOutFunc

func GetIsOutFunc() bool

GetIsOutFunc if is output func .

func GetIsOutSQL

func GetIsOutSQL() bool

GetIsOutSQL if is output sql .

func GetIsTableName

func GetIsTableName() bool

GetIsTableName if is table name .

func GetIsWEBTag

func GetIsWEBTag() bool

GetIsWEBTag json tag.json标记

func GetIsWebTagPkHidden

func GetIsWebTagPkHidden() bool

GetIsWebTagPkHidden web tag是否隐藏主键

func GetLG

func GetLG() string

GetLG get language tag.

func GetMysqlConStr

func GetMysqlConStr() string

GetMysqlConStr Get MySQL connection string.获取mysql 连接字符串

func GetOriginTableNames

func GetOriginTableNames() string

GetOriginTableNames get origin tableNames. 获取原始的设置的表名

func GetOutDir

func GetOutDir() string

GetOutDir Get Output Directory.获取输出目录

func GetOutFileName

func GetOutFileName() string

GetOutFileName 获取输出文件名

func GetSelfTypeDefine

func GetSelfTypeDefine() map[string]string

GetSelfTypeDefine 获取自定义字段映射

func GetSimple

func GetSimple() bool

GetSimple simple output.简单输出

func GetTableNames

func GetTableNames() string

GetTableNames get format tableNames by config. 获取格式化后设置的表名

func GetTablePrefix

func GetTablePrefix() string

GetTablePrefix get table prefix

func GetURLTag

func GetURLTag() string

GetURLTag get url tag.

func GetWebTagType

func GetWebTagType() int

GetWebTagType 获取json tag类型

func InitFile

func InitFile(filename string) error

InitFile default value from file .

func IsRunTesting

func IsRunTesting() bool

IsRunTesting Determine whether to use it in a test environment.判断是否在测试环境下使用

func SaveToFile

func SaveToFile() error

SaveToFile save config info to file

func SetDBTag

func SetDBTag(s string)

SetDBTag get database tag.

func SetForeignKey

func SetForeignKey(b bool)

SetForeignKey Set if is foreign key.设置是否外键关联

func SetIsColumnName

func SetIsColumnName(isColumnName bool)

SetIsColumnName set gen ColumnName config. 设置生成列名的config

func SetIsDev

func SetIsDev(b bool)

SetIsDev is is dev

func SetIsGUI

func SetIsGUI(b bool)

SetIsGUI if is gui show .

func SetIsNullToPoint

func SetIsNullToPoint(b bool)

SetIsNullToPoint if with null to porint in struct

func SetIsOutFileByTableName

func SetIsOutFileByTableName(isOutFileByTableName bool)

SetIsOutFileByTableName set gen ColumnName config. 设置是否根据表名生成文件

func SetIsOutFunc

func SetIsOutFunc(b bool)

SetIsOutFunc if is output func .

func SetIsOutSQL

func SetIsOutSQL(b bool)

SetIsOutSQL if is output sql .

func SetIsTableName

func SetIsTableName(b bool)

SetIsTableName if is table name .

func SetIsWEBTag

func SetIsWEBTag(b bool)

SetIsWEBTag json tag.json标记

func SetLG

func SetLG(s string)

SetLG set url tag.

func SetMysqlDbInfo

func SetMysqlDbInfo(info *DBInfo)

SetMysqlDbInfo Update MySQL configuration information

func SetOutDir

func SetOutDir(outDir string)

SetOutDir Setting Output Directory.设置输出目录

func SetOutFileName

func SetOutFileName(s string)

SetOutFileName 设置输出文件名

func SetSelfTypeDefine

func SetSelfTypeDefine(data map[string]string)

SetSelfTypeDefine 设置自定义字段映射

func SetSimple

func SetSimple(b bool)

SetSimple simple output.简单输出

func SetTableNames

func SetTableNames(tableNames string)

SetTableNames set tableNames. 设置生成的表名

func SetTablePrefix

func SetTablePrefix(t string)

SetTablePrefix set table prefix

func SetURLTag

func SetURLTag(s string)

SetURLTag set url tag.

func SetWebTagType

func SetWebTagType(i int)

SetWebTagType 设置json tag类型

Types

type CfgBase

type CfgBase struct {
	// SerialNumber       string `json:"serial_number" yaml:"serial_number"`             // version.版本号
	// ServiceName        string `json:"service_name" yaml:"service_name"`               // service name .service名字
	// ServiceDisplayname string `json:"service_displayname" yaml:"service_displayname"` // display name .显示名
	// SerciceDesc        string `json:"sercice_desc" yaml:"sercice_desc"`               // sercice desc .service描述
	IsDev bool `json:"is_dev" yaml:"is_dev"` // Is it a development version?是否是开发版本
}

CfgBase base config struct

type Config

type Config struct {
	CfgBase              `yaml:"base"`
	Database             DBInfo            `yaml:"database"`
	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"`
	IsWEBTag             bool              `yaml:"is_web_tag"`
	IsWebTagPkHidden     bool              `yaml:"is_web_tag_pk_hidden"` // web标记是否隐藏主键
	IsForeignKey         bool              `yaml:"is_foreign_key"`
	IsOutSQL             bool              `yaml:"is_out_sql"`
	IsOutFunc            bool              `yaml:"is_out_func"`
	IsGUI                bool              `yaml:"is_gui"` //
	IsTableName          bool              `yaml:"is_table_name"`
	IsNullToPoint        bool              `yaml:"is_null_to_point"` // null to porint
	TablePrefix          string            `yaml:"table_prefix"`     // 表前缀
	SelfTypeDef          map[string]string `yaml:"self_type_define"`
	OutFileName          string            `yaml:"out_file_name"`
	WebTagType           int               `yaml:"web_tag_type"`              // 默认小驼峰
	TableNames           string            `yaml:"table_names"`               // 表名(多个表名用","隔开)
	IsColumnName         bool              `yaml:"is_column_name"`            //是否输出列名
	IsOutFileByTableName bool              `yaml:"is_out_file_by_table_name"` //是否根据表名生成文件(多个表名生成多个文件)
}

Config custom config struct

type DBInfo

type DBInfo struct {
	Host     string `validate:"required"` // Host. 地址
	Port     int    // Port 端口号
	Username string // Username 用户名
	Password string // Password 密码
	Database string // Database 数据库名
	Type     int    // 数据库类型: 0:mysql , 1:sqlite , 2:mssql
}

DBInfo mysql database information. mysql 数据库信息

func GetDbInfo

func GetDbInfo() DBInfo

GetDbInfo Get configuration information .获取数据配置信息

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL