gen

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenTable

func GenTable(db Database)

GenTable 生成表

Types

type Database

type Database struct {
	Name         string          //数据库名 用于生成文件夹
	DB           *gorm.DB        //数据库连接
	Tables       []Table         //表
	TablePrefix  string          //表前缀
	ComOpts      *[]gen.ModelOpt //公共配置选项
	OutPath      string          //生成代码的路径
	ModelPkgPath string          //generated model code's package name
	// contains filtered or unexported fields
}

type Table

type Table struct {
	Name      string         //表名
	ModelName string         //模型名
	Opts      []gen.ModelOpt //表配置选项
	Relate    *[]TableRelate //关联表
}

func (Table) GetModelName

func (t Table) GetModelName(prefix string) string

type TableRelate

type TableRelate struct {
	TableName  string                 //关联的表名
	FieldName  string                 //字段名
	ForeignKey string                 //外键
	LocalKey   string                 //本表键
	Type       field.RelationshipType //关联方式
	Relate     *[]TableRelate
}

Jump to

Keyboard shortcuts

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