mysql

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	F_TEXT     = "string"
	F_INT      = "int"
	F_BOOL     = "bool"
	F_FLOAT    = "float64"
	F_DATETIME = "time.Time"
	F_ARRAY    = "array"
	F_M2O      = "*"
	F_O2M      = "[]*"
	F_O2O      = "*"
	F_M2M      = "[]*"
	F_ART      = "string"
	F_JSON     = "string"
	F_FILE     = "orm.File"
	F_FILES    = "orm.Files"
)

Variables

This section is empty.

Functions

func CreateApiPageReg

func CreateApiPageReg(creator *Creator)

func CreateConfig

func CreateConfig(c *Creator)

func CreateConfigPreload

func CreateConfigPreload(creator *Creator)

func CreateController

func CreateController(c *Creator)

func CreateCrud

func CreateCrud(creator *Creator)

func CreateEmptyController

func CreateEmptyController(c *Creator)

func CreateEzModelConfig

func CreateEzModelConfig(creator *Creator)

func CreateMigrate

func CreateMigrate(creator *Creator)

func CreateMod

func CreateMod(creator *Creator)

func CreateModel

func CreateModel(creator *Creator)

func CreateModelConfigFile

func CreateModelConfigFile(c *Creator)

func CreateOrmConfigFile

func CreateOrmConfigFile(c *Creator)

func CreateVueAdminFile

func CreateVueAdminFile(creator *Creator)

func GenerateConfig

func GenerateConfig(c *Creator)

func Init

func Init(c *Creator)

func SetRoot added in v1.0.1

func SetRoot(rt string)

func SetTwig

func SetTwig(tg *twig.Twig)

Types

type Art

type Art struct {
	BaseType
}

func (*Art) CreateConfig

func (art *Art) CreateConfig()

func (*Art) SetCnName

func (this *Art) SetCnName(v string) *Art

func (*Art) SetDefaultValue

func (this *Art) SetDefaultValue(v string) *Art

func (*Art) SetEntityType

func (this *Art) SetEntityType(v string) *Art

func (*Art) SetName

func (this *Art) SetName(v string) *Art

func (*Art) SetNullable

func (this *Art) SetNullable(v bool) *Art

func (*Art) SetOrm

func (this *Art) SetOrm(v string) *Art

func (*Art) SetSrc

func (this *Art) SetSrc(v string) *Art

func (*Art) SetType

func (this *Art) SetType(v string) *Art

type BaseRelation

type BaseRelation struct {
	BaseType
	OrmParam string
	SrcDir   string
	Table    Table
	Fk       string
	Ref      string
}

type BaseType

type BaseType struct {
	Name         string
	Type         string
	EntityType   string
	CnName       string
	Nullable     bool
	DefaultValue string
	Orm          string
	Src          string
	Desc         string
}

func (BaseType) GetConfig

func (this BaseType) GetConfig() BaseType

func (BaseType) GetEntityType

func (this BaseType) GetEntityType() string

func (BaseType) GetName

func (this BaseType) GetName() string

func (BaseType) GetOrm

func (this BaseType) GetOrm() string

func (BaseType) GetSrc

func (this BaseType) GetSrc() string

func (BaseType) GetType

func (this BaseType) GetType() string

func (*BaseType) SetCnName

func (this *BaseType) SetCnName(v string) *BaseType

func (*BaseType) SetDefaultValue

func (this *BaseType) SetDefaultValue(v string) *BaseType

func (*BaseType) SetDesc

func (this *BaseType) SetDesc(v string) *BaseType

func (*BaseType) SetEntityType

func (this *BaseType) SetEntityType(v string) *BaseType

func (*BaseType) SetName

func (this *BaseType) SetName(v string) *BaseType

func (*BaseType) SetNullable

func (this *BaseType) SetNullable(v bool) *BaseType

func (*BaseType) SetOrm

func (this *BaseType) SetOrm(v string) *BaseType

func (*BaseType) SetSrc

func (this *BaseType) SetSrc(v string) *BaseType

func (*BaseType) SetType

func (this *BaseType) SetType(v string) *BaseType

type Bool

type Bool struct {
	BaseType
}

func (*Bool) CreateConfig

func (f *Bool) CreateConfig()

func (*Bool) SetCnName

func (this *Bool) SetCnName(v string) *Bool

func (*Bool) SetDefaultValue

func (this *Bool) SetDefaultValue(v string) *Bool

func (*Bool) SetEntityType

func (this *Bool) SetEntityType(v string) *Bool

func (*Bool) SetName

func (this *Bool) SetName(v string) *Bool

func (*Bool) SetNullable

func (this *Bool) SetNullable(v bool) *Bool

func (*Bool) SetOrm

func (this *Bool) SetOrm(v string) *Bool

func (*Bool) SetSrc

func (this *Bool) SetSrc(v string) *Bool

func (*Bool) SetType

func (this *Bool) SetType(v string) *Bool

type Creator

type Creator struct {
	AppName    string      `json:"appName"`
	Table      *Table      `json:"table"`
	Fields     []FieldItem `json:"fields"`
	Model      string      `json:"model"` //数据模型,特殊模型需要使用该字段,比如tree
	SafeDelete bool        `json:"safeDelete"`
}

func NewTable

func NewTable(name string, cnName string, path string) *Creator

func (*Creator) AddArt

func (c *Creator) AddArt(name string, label string) *Art

func (*Creator) AddBool

func (c *Creator) AddBool(name string, label string) *Bool

func (*Creator) AddCode

func (c *Creator) AddCode() *Text

func (*Creator) AddContent

func (c *Creator) AddContent() *Art

func (*Creator) AddCreateAt

func (c *Creator) AddCreateAt() *DateTime

常用的二次封装

func (*Creator) AddCreateBy

func (c *Creator) AddCreateBy() *Int

func (*Creator) AddDateTime

func (c *Creator) AddDateTime(name string, label string) *DateTime

func (*Creator) AddDelete

func (c *Creator) AddDelete() *Bool

func (*Creator) AddFile

func (c *Creator) AddFile(name string, label string) *File

func (*Creator) AddFiles

func (c *Creator) AddFiles(name string, label string) *Files

func (*Creator) AddFloat

func (c *Creator) AddFloat(name string, label string) *Float

func (*Creator) AddInt

func (c *Creator) AddInt(name string, label string) *Int

func (*Creator) AddJson

func (c *Creator) AddJson(name string, label string) *Json

func (*Creator) AddLock

func (c *Creator) AddLock() *Bool

func (*Creator) AddManyToMany

func (c *Creator) AddManyToMany(name string, label string, src string) *ManyToMany

func (*Creator) AddManyToOne

func (c *Creator) AddManyToOne(name string, label string, src string) *ManyToOne

func (*Creator) AddName

func (c *Creator) AddName() *Text

func (*Creator) AddOneToMany

func (c *Creator) AddOneToMany(name string, label string, src string) *OneToMany

func (*Creator) AddOneToOne

func (c *Creator) AddOneToOne(name string, label string, src string) *OneToOne

func (*Creator) AddOwner

func (c *Creator) AddOwner() *Int

func (*Creator) AddSort

func (c *Creator) AddSort() *Int

func (*Creator) AddState

func (c *Creator) AddState() *Int

func (*Creator) AddText

func (c *Creator) AddText(name string, label string) *Text

func (*Creator) AddTitle

func (c *Creator) AddTitle() *Text

func (*Creator) AddUpdateAt

func (c *Creator) AddUpdateAt() *DateTime

func (*Creator) Generate

func (c *Creator) Generate()

func (*Creator) GetTable

func (c *Creator) GetTable() *Table

func (*Creator) IsTree

func (c *Creator) IsTree() *Table

func (*Creator) LoadDependence

func (c *Creator) LoadDependence() *Creator

func (*Creator) LoadStatus

func (c *Creator) LoadStatus() *Creator

func (*Creator) LoadTree

func (c *Creator) LoadTree() *Creator

func (*Creator) SetCnName

func (c *Creator) SetCnName(cnName string) *Table

func (*Creator) SetName

func (c *Creator) SetName(name string) *Table

func (*Creator) SetPath

func (c *Creator) SetPath(path string) *Table

type DateTime

type DateTime struct {
	BaseType
	IsAutoNow    bool
	IsAutoNowAdd bool
	OrmParam     string //auto_now; auto_now_add;
}

func (*DateTime) CreateConfig

func (f *DateTime) CreateConfig()

func (*DateTime) SetCnName

func (this *DateTime) SetCnName(v string) *DateTime

func (*DateTime) SetDefaultValue

func (this *DateTime) SetDefaultValue(v string) *DateTime

func (*DateTime) SetEntityType

func (this *DateTime) SetEntityType(v string) *DateTime

func (*DateTime) SetIsAutoNow

func (this *DateTime) SetIsAutoNow(is bool) *DateTime

是否在更新时自动填充

func (*DateTime) SetIsAutoNowAdd

func (this *DateTime) SetIsAutoNowAdd(is bool) *DateTime

是否在初次创建时自动填充

func (*DateTime) SetName

func (this *DateTime) SetName(v string) *DateTime

func (*DateTime) SetNullable

func (this *DateTime) SetNullable(v bool) *DateTime

func (*DateTime) SetOrm

func (this *DateTime) SetOrm(v string) *DateTime

func (*DateTime) SetSrc

func (this *DateTime) SetSrc(v string) *DateTime

func (*DateTime) SetType

func (this *DateTime) SetType(v string) *DateTime

type Field

type Field struct {
	CnName        string `json:"cnName" groups:"app" orm:"null;description(字段名中文);on_delete(set_null);size(20);"`
	Name          string `json:"name" groups:"app" orm:"null;description(字段名);on_delete(set_null);size(20);"`
	Type          int    `json:"type" groups:"app" orm:"null;description(数据类型);on_delete(set_null);rel(fk);"`
	Length        string `json:"length" groups:"app" orm:"null;description(长度);on_delete(set_null);size(255);"`
	Nullable      bool   `json:"nullable" groups:"app" orm:"null;description(语序为空);on_delete(set_null);"`
	DataSrc       string `json:"dataSrc" groups:"app" orm:"null;description(数据源);on_delete(set_null);size(64);"`
	DataSrControl bool   `json:"dataSrControl" groups:"app" orm:"null;description(主控);on_delete(set_null);"`
	DefaultValue  string `json:"defaultValue" groups:"app" orm:"null;description(默认值);on_delete(set_null);size(255);"`
	OrmParam      string `json:"ormParam" groups:"app" orm:"null;description(orm参数);on_delete(set_null);size(255);"`
}

type FieldItem

type FieldItem interface {
	GetConfig() BaseType
	GetName() string
	GetType() string
	GetEntityType() string
	GetSrc() string
	GetOrm() string
	CreateConfig()
}

type File

type File struct {
	BaseType
}

func (*File) CreateConfig

func (json *File) CreateConfig()

func (*File) SetCnName

func (this *File) SetCnName(v string) *File

func (*File) SetDefaultValue

func (this *File) SetDefaultValue(v string) *File

func (*File) SetEntityType

func (this *File) SetEntityType(v string) *File

func (*File) SetName

func (this *File) SetName(v string) *File

func (*File) SetNullable

func (this *File) SetNullable(v bool) *File

func (*File) SetOrm

func (this *File) SetOrm(v string) *File

func (*File) SetSrc

func (this *File) SetSrc(v string) *File

func (*File) SetType

func (this *File) SetType(v string) *File

type Files

type Files struct {
	BaseType
}

func (*Files) CreateConfig

func (json *Files) CreateConfig()

func (*Files) SetCnName

func (this *Files) SetCnName(v string) *Files

func (*Files) SetDefaultValue

func (this *Files) SetDefaultValue(v string) *Files

func (*Files) SetEntityType

func (this *Files) SetEntityType(v string) *Files

func (*Files) SetName

func (this *Files) SetName(v string) *Files

func (*Files) SetNullable

func (this *Files) SetNullable(v bool) *Files

func (*Files) SetOrm

func (this *Files) SetOrm(v string) *Files

func (*Files) SetSrc

func (this *Files) SetSrc(v string) *Files

func (*Files) SetType

func (this *Files) SetType(v string) *Files

type Float

type Float struct {
	BaseType
	Base     string
	Digits   int    //数字位长度
	Decimals int    //小数位精度
	OrmParam string //digits(12); decimals(4);
}

func (*Float) CreateConfig

func (f *Float) CreateConfig()

func (*Float) SetBase

func (this *Float) SetBase(v string) *Float

func (*Float) SetCnName

func (this *Float) SetCnName(v string) *Float

func (*Float) SetDecimals

func (f *Float) SetDecimals(dec int) *Float

设置小数位保留精度

func (*Float) SetDefaultValue

func (this *Float) SetDefaultValue(v string) *Float

func (*Float) SetDigits

func (f *Float) SetDigits(dig int) *Float

设置整数位长度

func (*Float) SetEntityType

func (this *Float) SetEntityType(v string) *Float

func (*Float) SetName

func (this *Float) SetName(v string) *Float

func (*Float) SetNullable

func (this *Float) SetNullable(v bool) *Float

func (*Float) SetOrm

func (this *Float) SetOrm(v string) *Float

func (*Float) SetSrc

func (this *Float) SetSrc(v string) *Float

func (*Float) SetType

func (this *Float) SetType(v string) *Float

type Int

type Int struct {
	BaseType
	Base string
}

func (*Int) CreateConfig

func (f *Int) CreateConfig()

func (*Int) SetBase

func (this *Int) SetBase(v string) *Int

func (*Int) SetCnName

func (this *Int) SetCnName(v string) *Int

func (*Int) SetDefaultValue

func (this *Int) SetDefaultValue(v string) *Int

func (*Int) SetEntityType

func (this *Int) SetEntityType(v string) *Int

func (*Int) SetName

func (this *Int) SetName(v string) *Int

func (*Int) SetNullable

func (this *Int) SetNullable(v bool) *Int

func (*Int) SetOrm

func (this *Int) SetOrm(v string) *Int

func (*Int) SetSrc

func (this *Int) SetSrc(v string) *Int

func (*Int) SetType

func (this *Int) SetType(v string) *Int

type Json

type Json struct {
	BaseType
}

func (*Json) CreateConfig

func (json *Json) CreateConfig()

func (*Json) SetCnName

func (this *Json) SetCnName(v string) *Json

func (*Json) SetDefaultValue

func (this *Json) SetDefaultValue(v string) *Json

func (*Json) SetEntityType

func (this *Json) SetEntityType(v string) *Json

func (*Json) SetName

func (this *Json) SetName(v string) *Json

func (*Json) SetNullable

func (this *Json) SetNullable(v bool) *Json

func (*Json) SetOrm

func (this *Json) SetOrm(v string) *Json

func (*Json) SetSrc

func (this *Json) SetSrc(v string) *Json

func (*Json) SetType

func (this *Json) SetType(v string) *Json

type ManyToMany

type ManyToMany struct {
	BaseRelation
	IsControl bool
	LinkTable string
}

func (*ManyToMany) CreateConfig

func (f *ManyToMany) CreateConfig()

func (*ManyToMany) SetCnName

func (this *ManyToMany) SetCnName(v string) *ManyToMany

func (*ManyToMany) SetDefaultValue

func (this *ManyToMany) SetDefaultValue(v string) *ManyToMany

func (*ManyToMany) SetEntityType

func (this *ManyToMany) SetEntityType(v string) *ManyToMany

func (*ManyToMany) SetFk

func (this *ManyToMany) SetFk(v string) *ManyToMany

func (*ManyToMany) SetIsControl

func (f *ManyToMany) SetIsControl(ctrl bool) *ManyToMany

func (*ManyToMany) SetLinkTable

func (this *ManyToMany) SetLinkTable(v string) *ManyToMany

func (*ManyToMany) SetName

func (this *ManyToMany) SetName(v string) *ManyToMany

func (*ManyToMany) SetNullable

func (this *ManyToMany) SetNullable(v bool) *ManyToMany

func (*ManyToMany) SetOrm

func (this *ManyToMany) SetOrm(v string) *ManyToMany

func (*ManyToMany) SetRef

func (this *ManyToMany) SetRef(v string) *ManyToMany

func (*ManyToMany) SetSrc

func (this *ManyToMany) SetSrc(v string) *ManyToMany

func (*ManyToMany) SetSrcDir

func (this *ManyToMany) SetSrcDir(v string) *ManyToMany

func (*ManyToMany) SetType

func (this *ManyToMany) SetType(v string) *ManyToMany

type ManyToOne

type ManyToOne struct {
	BaseRelation
}

func (*ManyToOne) CreateConfig

func (f *ManyToOne) CreateConfig()

func (*ManyToOne) SetCnName

func (this *ManyToOne) SetCnName(v string) *ManyToOne

func (*ManyToOne) SetDefaultValue

func (this *ManyToOne) SetDefaultValue(v string) *ManyToOne

func (*ManyToOne) SetEntityType

func (this *ManyToOne) SetEntityType(v string) *ManyToOne

func (*ManyToOne) SetFk

func (this *ManyToOne) SetFk(v string) *ManyToOne

func (*ManyToOne) SetName

func (this *ManyToOne) SetName(v string) *ManyToOne

func (*ManyToOne) SetNullable

func (this *ManyToOne) SetNullable(v bool) *ManyToOne

func (*ManyToOne) SetOrm

func (this *ManyToOne) SetOrm(v string) *ManyToOne

func (*ManyToOne) SetRef

func (this *ManyToOne) SetRef(v string) *ManyToOne

func (*ManyToOne) SetSrc

func (this *ManyToOne) SetSrc(v string) *ManyToOne

func (*ManyToOne) SetSrcDir

func (this *ManyToOne) SetSrcDir(v string) *ManyToOne

func (*ManyToOne) SetType

func (this *ManyToOne) SetType(v string) *ManyToOne

type OneToMany

type OneToMany struct {
	BaseRelation
}

func (*OneToMany) CreateConfig

func (f *OneToMany) CreateConfig()

func (*OneToMany) SetCnName

func (this *OneToMany) SetCnName(v string) *OneToMany

func (*OneToMany) SetDefaultValue

func (this *OneToMany) SetDefaultValue(v string) *OneToMany

func (*OneToMany) SetEntityType

func (this *OneToMany) SetEntityType(v string) *OneToMany

func (*OneToMany) SetFk

func (this *OneToMany) SetFk(v string) *OneToMany

func (*OneToMany) SetName

func (this *OneToMany) SetName(v string) *OneToMany

func (*OneToMany) SetNullable

func (this *OneToMany) SetNullable(v bool) *OneToMany

func (*OneToMany) SetOrm

func (this *OneToMany) SetOrm(v string) *OneToMany

func (*OneToMany) SetSrc

func (this *OneToMany) SetSrc(v string) *OneToMany

func (*OneToMany) SetSrcDir

func (this *OneToMany) SetSrcDir(v string) *OneToMany

func (*OneToMany) SetType

func (this *OneToMany) SetType(v string) *OneToMany

type OneToOne

type OneToOne struct {
	BaseRelation
	IsControl bool
}

func (*OneToOne) CreateConfig

func (f *OneToOne) CreateConfig()

func (*OneToOne) SetCnName

func (this *OneToOne) SetCnName(v string) *OneToOne

func (*OneToOne) SetDefaultValue

func (this *OneToOne) SetDefaultValue(v string) *OneToOne

func (*OneToOne) SetEntityType

func (this *OneToOne) SetEntityType(v string) *OneToOne

func (*OneToOne) SetFk

func (this *OneToOne) SetFk(v string) *OneToOne

func (*OneToOne) SetIsControl

func (f *OneToOne) SetIsControl(ctrl bool) *OneToOne

func (*OneToOne) SetName

func (this *OneToOne) SetName(v string) *OneToOne

func (*OneToOne) SetNullable

func (this *OneToOne) SetNullable(v bool) *OneToOne

func (*OneToOne) SetOrm

func (this *OneToOne) SetOrm(v string) *OneToOne

func (*OneToOne) SetRef

func (this *OneToOne) SetRef(v string) *OneToOne

func (*OneToOne) SetSrc

func (this *OneToOne) SetSrc(v string) *OneToOne

func (*OneToOne) SetSrcDir

func (this *OneToOne) SetSrcDir(v string) *OneToOne

func (*OneToOne) SetType

func (this *OneToOne) SetType(v string) *OneToOne

type OrmField

type OrmField struct {
	Name string
	Type string
	Tags string
}

**************************Model创建********************************

type Table

type Table struct {
	Name   string      `json:"name" groups:"app" orm:"null;description(数据表);on_delete(set_null);size(255);"`
	CnName string      `json:"cnName" groups:"app" orm:"null;description(中文名称);on_delete(set_null);size(255);"`
	Path   string      `json:"path" groups:"app" orm:"null;description(实体路径);on_delete(set_null);size(255);"`
	Fields []FieldItem `json:"fields" groups:"app" orm:"null;description(字段集);on_delete(set_null);reverse(many);"`
}

type Text

type Text struct {
	BaseType
	Length string
}

func (*Text) CreateConfig

func (text *Text) CreateConfig()

func (*Text) SetCnName

func (this *Text) SetCnName(v string) *Text

func (*Text) SetDefaultValue

func (this *Text) SetDefaultValue(v string) *Text

func (*Text) SetEntityType

func (this *Text) SetEntityType(v string) *Text

func (*Text) SetLength

func (this *Text) SetLength(v int) *Text

func (*Text) SetName

func (this *Text) SetName(v string) *Text

func (*Text) SetNullable

func (this *Text) SetNullable(v bool) *Text

func (*Text) SetOrm

func (this *Text) SetOrm(v string) *Text

func (*Text) SetSrc

func (this *Text) SetSrc(v string) *Text

func (*Text) SetType

func (this *Text) SetType(v string) *Text

Jump to

Keyboard shortcuts

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