config

package
v0.0.0-...-053c7d0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const MODEL_STRUCT_TEMPLATE = `package {package}

type {struct_name} struct {
	{struct_field} ` + "`" + `json:"{column_name}" db:"{column_name}"` + "`" + `
}

func (p {struct_name}) TableName() string {
	return "{table_name}"
}
`

Config the model template for go file. {package},{struct_name},{struct_field} is required for template string

Variables

View Source
var (
	DbTypeMap = map[string]string{
		"tinyint":    "int8",
		"smallint":   "int16",
		"mediumint":  "int32",
		"int":        "int32",
		"integer":    "int32",
		"bigint":     "int64",
		"float":      "float64",
		"double":     "float64",
		"decimal":    "float64",
		"date":       "string",
		"datetime":   "time.Time",
		"timestamp":  "time.Time",
		"time":       "time.Time",
		"year":       "uint8",
		"varbinary":  "string",
		"enum":       "string",
		"set":        "string",
		"char":       "string",
		"varchar":    "string",
		"binary":     "string",
		"tinytext":   "string",
		"text":       "string",
		"mediumtext": "string",
		"longtext":   "string",
		"tinyblob":   "[]byte",
		"mediumblob": "[]byte",
		"blob":       "[]byte",
		"longblob":   "[]byte",
	}
	DbUnsignedTypeMap = map[string]string{
		"tinyint":   "uint8",
		"smallint":  "uint16",
		"mediumint": "uint32",
		"int":       "uint32",
		"integer":   "uint32",
		"bigint":    "uint64",
	}
	DbType    = "mysql"
	FileModel = "0777"
)

Functions

This section is empty.

Types

type Config

type Config struct {
	DbType      string       `json:"db_type"`
	FileMode    string       `json:"file_mode"`
	OutConfList []OutputConf `json:"out_conf_list"`
}

type OutputConf

type OutputConf struct {
	DbDn          string   `json:"db_dn"`
	OutputDir     string   `json:"output_dir"`
	TablePrefix   string   `json:"table_prefix"`
	SelectTables  []string `json:"select_tables"`
	ModelPackage  string   `json:"model_package"`
	ExcludeFields string   `json:"exclude_fields"`
}

Jump to

Keyboard shortcuts

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