repository

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileModel

type FileModel struct {
	FileName string      // 文件名
	Content  interface{} // 文件内容
}

type GormRepository

type GormRepository struct {
	// contains filtered or unexported fields
}

func (*GormRepository) GenerateModels

func (u *GormRepository) GenerateModels(tblPrefix string, tablesInfos []*TableInfo, packageName string) ([]*FileModel, error)

GenerateModels 生成models文件内容

func (*GormRepository) GetTablesInfo

func (u *GormRepository) GetTablesInfo(tableName []string, tblPrefix string) ([]*TableInfo, error)

GetTablesInfo 获取指定表信息

type IDbRepository

type IDbRepository interface {
	// GetTablesInfo 获取指定表信息
	GetTablesInfo(tableName []string, tblPrefix string) ([]*TableInfo, error)
	// GenerateModels 生成models文件内容
	GenerateModels(tblPrefix string, tablesInfo []*TableInfo, packageName string) ([]*FileModel, error)
}

func NewGormRepository

func NewGormRepository(ctx context.Context, db *gorm.DB) IDbRepository

NewGormRepository 创建 Repository

type TableInfo

type TableInfo struct {
	Name    string `gorm:"column:Name"`    //表名
	Comment string `gorm:"column:Comment"` //表注释
}

Jump to

Keyboard shortcuts

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