internal

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RelatedTablePrefix     = "Rltd"
	RelatedTableJsonPrefix = "rltd"
)

Variables

View Source
var (
	ColumnTypeStr       = []string{"char", "varchar", "varchar2", "tinytext", "text", "mediumtext", "longtext", "binary", "varbinary", "blob"}
	ColumnTypeDate      = []string{"date"}
	ColumnTypeTime      = []string{"datetime", "time", "timestamp"}
	ColumnTypeNumber    = []string{"tinyint", "smallint", "mediumint", "int", "integer", "bigint", "float", "double", "decimal", "numeric", "bit"}
	ColumnNameNotEdit   = []string{"created_by", "created_at", "updated_by", "updated_at", "deleted_at"}
	ColumnNameNotList   = []string{"updated_by", "updated_at", "deleted_at"}
	ColumnNameNotDetail = []string{"updated_by", "updated_at", "deleted_at"}
	ColumnNameNotQuery  = []string{"updated_by", "updated_at", "deleted_at", "remark"}
)
View Source
var DbTableImporter = new(dbTableImporter)

Functions

func GenCodeByTableDefYaml

func GenCodeByTableDefYaml(ctx context.Context, tableName string, genOptions *GenOptions) error

func GetColumnLength

func GetColumnLength(columnType string) int

GetColumnLength 获取字段长度

func GetDbType

func GetDbType(columnType string) string

GetDbType 获取数据库类型字段

func GetGoModule

func GetGoModule(file string) (string, error)

func GetGoModuleName

func GetGoModuleName() (string, error)

func IsDateObject

func IsDateObject(dataType string) bool

IsDateObject 判断是否是数据库时间类型

func IsExistInArray

func IsExistInArray(value string, array []string) bool

IsExistInArray 判断 value 是否存在在切片array中

func IsNumberObject

func IsNumberObject(dataType string) bool

IsNumberObject 是否数字类型

func IsStringObject

func IsStringObject(dataType string) bool

IsStringObject 判断是否是数据库字符串类型

func IsTimeObject

func IsTimeObject(dataType string) bool

IsTimeObject 判断是否是数据库时间类型

func LoadTableDefYaml

func LoadTableDefYaml(ctx context.Context, tableName string, yamlInputPath string, goModuleName string, cache map[string]*tableDef) (*tableDef, error)
func ParseDblink(dblink string) error

func SplitComma

func SplitComma(str string) []string

func TemplateEngine

func TemplateEngine() *gview.View

func TrimBreak

func TrimBreak(str string) (rStr string, err error)

func WriteFile

func WriteFile(fileName, data string, cover bool) (err error)

Types

type GenOptions

type GenOptions struct {
	YamlInputPath string
	GoModuleName  string
	ServiceOnly   bool
	FrontendType  string
	FrontendPath  string
}

type ImportOptions

type ImportOptions struct {
	BackendPackage      string
	FrontendModule      string
	GoModuleName        string
	TableNames          []string
	TablePrefixesOnly   []string
	RemoveTablePrefixes []string
	YamlOutputPath      string
	Prefix              string
	SeparatePackage     bool
	TemplateCategory    string
	Author              string
	Overwrite           bool
	ShowDetail          bool
	IsRpc               bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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