gen

package
v0.0.0-...-fc3359f Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DB *gorm.DB
)

Functions

func CreateDir

func CreateDir(req GenReq)

创建需要的文件夹

func GenHandler

func GenHandler(req GenReq)

func GenInitlialize

func GenInitlialize(req GenReq)

func GenModel

func GenModel(req GenReq)

GenModel 生成 model

func GenProto

func GenProto(req GenReq)

func GenRepository

func GenRepository(req GenReq)

func GenService

func GenService(req GenReq)

//////////////////////////////////////////////////////////////////////////////

func GenT

func GenT(req GenReq)

GenT 生成测试案例

func GenWeb

func GenWeb(req GenReq)

func GetJsonTagFromCase

func GetJsonTagFromCase(str, caseStr string) string

func InitDB

func InitDB(host, port, user, password, db string)

func Run

func Run(host, user, password, port, db, table, serverName, protoName string)

Types

type GenReq

type GenReq struct {
	TableName     string
	SrvName       string
	ProtoName     string
	BaseDir       string
	DomainDir     string
	ModelDir      string
	RepositoryDir string
	ServiceDir    string
	HandlerDir    string
	InitializeDir string
	ProtoDir      string
	TestDir       string
	WebBaseDir    string

	TableColumns []TableColumn
}

func GenInit

func GenInit(srvName, tableName, protoName string) GenReq

type TableColumn

type TableColumn struct {
	Field   string `gorm:"column:Field"`   // 字段名称
	Type    string `gorm:"column:Type"`    // 字段类型
	Null    string `gorm:"column:Null"`    // 是否空
	Key     string `gorm:"column:Key"`     // 索引
	Default string `gorm:"column:Default"` // 默认值
	Extra   string `gorm:"column:Extra"`   // 扩展
	Comment string `gorm:"column:Comment"` // 备注
}

func GetTableCol

func GetTableCol(table string) []TableColumn

Jump to

Keyboard shortcuts

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