generator

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModelPkg = "model"
)
View Source
const (
	Version = "1.2.1"
)

Variables

This section is empty.

Functions

func RenderWithMap

func RenderWithMap(outPath, tmplDir, tmplName string, data map[string]interface{}, cover bool)

func RenderWithStruct

func RenderWithStruct(outPath, tmplDir, tmplName string, data interface{}, cover bool)

Types

type BaseStruct

type BaseStruct struct {
	Package    string
	StructName string
	TableName  string
	Imports    string
	Members    []*Member
}

type Column

type Column struct {
	TableName     string `gorm:"column:TABLE_NAME"`
	ColumnName    string `gorm:"column:COLUMN_NAME"`
	ColumnComment string `gorm:"column:COLUMN_COMMENT"`
	DataType      string `gorm:"column:DATA_TYPE"`
	ColumnKey     string `gorm:"column:COLUMN_KEY"`
	ColumnType    string `gorm:"column:COLUMN_TYPE"`
	ColumnDefault string `gorm:"column:COLUMN_DEFAULT"`
	Extra         string `gorm:"column:EXTRA"`
	IsNullable    string `gorm:"column:IS_NULLABLE"`
}

Column table column's info

func (*Column) AutoIncrement

func (c *Column) AutoIncrement() bool

func (*Column) IsPrimaryKey

func (c *Column) IsPrimaryKey() bool

type DaoBaseStruct

type DaoBaseStruct struct {
	DaoPackageName string
}

type DaoStruct

type DaoStruct struct {
	TableName        string
	StructName       string
	DaoPackageName   string
	ModelPackageName string
	ModelFQPN        string
}

type GormDaoGenerator

type GormDaoGenerator struct {
	DB               *gorm.DB
	PackageName      string
	ModelPackageName string
	ModelPath        string
	DaoPackageName   string
	DaoPath          string
	Database         string
	TmplPath         string
}

func NewGormGenerator

func NewGormGenerator(connStr, database, prefix, packageName, tmplPath, modelPackage, modelPath, daoPackage, daoPath string) *GormDaoGenerator

func (*GormDaoGenerator) Gen

func (g *GormDaoGenerator) Gen()

func (*GormDaoGenerator) GenDaoStruct

func (g *GormDaoGenerator) GenDaoStruct(tableName string) DaoStruct

func (*GormDaoGenerator) GenTableStruct

func (g *GormDaoGenerator) GenTableStruct(tableName string) BaseStruct

func (*GormDaoGenerator) Tables

func (g *GormDaoGenerator) Tables() (dbTables []string)

Tables 获取所有数据表 不包含分表

type Member

type Member struct {
	Name          string
	Type          string
	NewType       string
	ColumnName    string
	ColumnComment string
	ColumnDefault string
	ModelType     string
	JSONTag       string
	GORMTag       string
	NewTag        string
}

Member user input structures

Jump to

Keyboard shortcuts

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