Documentation ¶
Index ¶
- func GenerateTemplate(table *Table, filePath string, temp string) error
- type Column
- type Executor
- type MySqlExecutor
- func (m *MySqlExecutor) ColumnMetaHandle(column *Column) error
- func (m *MySqlExecutor) GenerateController(table *Table) error
- func (m *MySqlExecutor) GenerateDomain(table *Table) error
- func (m *MySqlExecutor) GenerateModel(table *Table) error
- func (m *MySqlExecutor) GenerateService(table *Table) error
- func (m *MySqlExecutor) GetTableColumns(tableName string, db *sql.DB, dbName string) ([]Column, error)
- func (m *MySqlExecutor) GetTableMetadata(db *sql.DB, dbName string) ([]Table, error)
- func (m *MySqlExecutor) TableHandle(table *Table) error
- type Table
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Column ¶
type Column struct { Name string // 字段名 ModelName string // 模板类型 Type string // 类型 ModelType string // 模板类型 DomainType string // 数据类型 ModelTag string // 标签 DomainTag string // 数据标签 Comment string // 注释 ModelComment string // 模板注释 Key string // 索引信息 }
Column represents a table column.
type Executor ¶
type Executor interface { // GetTableMetadata 获取库元数据 GetTableMetadata(db *sql.DB, dbName string) ([]Table, error) // GetTableColumns 获取表元数据 GetTableColumns(tableName string, db *sql.DB, dbName string) ([]Column, error) // ColumnMetaHandle 处理列元数据 ColumnMetaHandle(column *Column) error // GenerateModel 生成Model业务代码 GenerateModel(table *Table) error // GenerateDomain 生成数据代码 GenerateDomain(table *Table) error // GenerateService 生成业务层代码 GenerateService(table *Table) error // GenerateController 生成控制层业务代码 GenerateController(table *Table) error }
Executor 生成业务代码所需实现的接口
type MySqlExecutor ¶
type MySqlExecutor struct { }
func (*MySqlExecutor) ColumnMetaHandle ¶
func (m *MySqlExecutor) ColumnMetaHandle(column *Column) error
func (*MySqlExecutor) GenerateController ¶
func (m *MySqlExecutor) GenerateController(table *Table) error
func (*MySqlExecutor) GenerateDomain ¶
func (m *MySqlExecutor) GenerateDomain(table *Table) error
func (*MySqlExecutor) GenerateModel ¶
func (m *MySqlExecutor) GenerateModel(table *Table) error
func (*MySqlExecutor) GenerateService ¶
func (m *MySqlExecutor) GenerateService(table *Table) error
func (*MySqlExecutor) GetTableColumns ¶
func (*MySqlExecutor) GetTableMetadata ¶
func (*MySqlExecutor) TableHandle ¶
func (m *MySqlExecutor) TableHandle(table *Table) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.