orm

package
v0.0.0-...-adf8682 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CreateTable = "Create Table"
)
View Source
const (
	Mysql = DbType("mysql")
)

type

Variables

This section is empty.

Functions

func FillDNS

func FillDNS(userName string, password string, host string, port int, dbName string, charset string) string

Types

type Config

type Config struct {

	// db
	DbType     DbType
	DbName     string
	DbPort     int
	DbHost     string
	DbUserName string
	DbPassword string
	DbCharset  string

	// save
	SaveFile string

	// table
	TableNames []string

	// template
	GeneratorModel   bool
	GeneratorDao     bool
	GeneratorDto     bool
	DaoPackageName   string
	ModelPackageName string
	DtoPackageName   string
	Tags             []string
	// contains filtered or unexported fields
}

func (*Config) Generator

func (config *Config) Generator() error

type DaoMeta

type DaoMeta struct {
	DaoPackage   string
	TableName    string
	ModelPackage string
}

func (*DaoMeta) GetModelName

func (this *DaoMeta) GetModelName() string

func (*DaoMeta) GetModelPackage

func (this *DaoMeta) GetModelPackage() string

func (*DaoMeta) GetModelPathName

func (this *DaoMeta) GetModelPathName() string

func (*DaoMeta) GetNewStructFunc

func (this *DaoMeta) GetNewStructFunc() string

* 获取new初始化的名称

func (*DaoMeta) GetStructName

func (this *DaoMeta) GetStructName() string

* 获取 struct name

func (*DaoMeta) Run

func (this *DaoMeta) Run(temp *template.Template) ([]byte, error)

func (*DaoMeta) Validate

func (this *DaoMeta) Validate() error

type DbMeta

type DbMeta interface {
	GetTables() ([]string, error)
}

func NewMysqlMeta

func NewMysqlMeta(dbName string, db *xorm.Engine) DbMeta

type DbType

type DbType string

func GetDbType

func GetDbType(str string) DbType

type DtoMeta

type DtoMeta struct {
	TableName  string
	TableField []FieldMeta
}

type DtoMetas

type DtoMetas struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewDtoMeta

func NewDtoMeta(packageName string) *DtoMetas

func (*DtoMetas) Append

func (this *DtoMetas) Append(meta *ModelMeta)

func (*DtoMetas) Run

func (this *DtoMetas) Run(tmpl *template.Template) ([]byte, error)

type FieldMeta

type FieldMeta struct {
	Name          string
	FieldType     string
	IsNullable    string //OK  YES
	ColumnComment string // 字段描述信息
	Tags          []string
}

func (*FieldMeta) GetDtoTag

func (this *FieldMeta) GetDtoTag() string

func (*FieldMeta) GetGoDaoType

func (this *FieldMeta) GetGoDaoType() string

func (*FieldMeta) GetGoField

func (this *FieldMeta) GetGoField() string

func (*FieldMeta) GetGoType

func (this *FieldMeta) GetGoType() string

func (*FieldMeta) GetTag

func (this *FieldMeta) GetTag() string

type ModelMeta

type ModelMeta struct {
	DbName      string
	TableName   string
	PackageName string
	Fields      []FieldMeta
	Db          *xorm.Engine
	Tags        []string
	// contains filtered or unexported fields
}

func NewModelMeta

func NewModelMeta(dbName string, tableName string, packageName string, db *xorm.Engine, tags []string) *ModelMeta

func (*ModelMeta) FindField

func (this *ModelMeta) FindField() error

func (*ModelMeta) GetCreateSql

func (this *ModelMeta) GetCreateSql() (string, error)

func (*ModelMeta) HasTimeFiled

func (this *ModelMeta) HasTimeFiled() bool

func (*ModelMeta) ModelName

func (this *ModelMeta) ModelName() string

func (*ModelMeta) Run

func (this *ModelMeta) Run(template *template.Template) ([]byte, error)

type Template

type Template interface {
	Run(template *template.Template) ([]byte, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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