model

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenUUid

func GenUUid() string

生成uuid

Types

type ComplexModelC

type ComplexModelC struct {
	Id      uint64 `xorm:"autoincr pk unique" json:"id"`
	Name    string `xorm:"varchar(20)" json:"name"`
	NowTime time.Time
	Count   uint
}

type ComplexModelD

type ComplexModelD struct {
	Id               uint64        `xorm:"autoincr pk unique" json:"id"`
	Name             string        `xorm:"varchar(20)" json:"name"`
	TestString       string        `xorm:"varchar(20)" json:"test_string"`
	TestInt          int           `xorm:"" json:"test_int"`
	TestInt8         int8          `xorm:"" json:"test_int_8"`
	TestInt16        int16         `xorm:"" json:"test_int_16"`
	TestInt32        int32         `xorm:"" json:"test_int_32"`
	TestInt64        int64         `xorm:"" json:"test_int_64"`
	TestUint         uint          `xorm:"" json:"test_uint"`
	TestUint8        uint8         `xorm:"" json:"test_uint_8"`
	TestUint16       uint16        `xorm:"" json:"test_uint_16"`
	TestUint32       uint32        `xorm:"" json:"test_uint_32"`
	TestUint64       uint64        `xorm:"" json:"test_uint_64"`
	TestFloat32      float32       `json:"test_float_32"`
	TestFloat64      float64       `json:"test_float_64"`
	TestTimeDuration time.Duration `json:"test_time_duration"`
	TestTimeTime     time.Time     `json:"test_time_time"`
	TestBool         bool          `json:"test_bool"`
	TestFk           string        `json:"test_fk" sp:"fk('ComplexModelC')"`            // one to one
	TestManyFk       string        `json:"test_many_fk" sp:"fk:ComplexModelC multiple"` // one to many
}

type CustomReqBValid added in v1.0.8

type CustomReqBValid struct {
	Desc string `json:"desc" validate:"required"`
}

type CustomReqValid added in v1.0.8

type CustomReqValid struct {
	Id   uint64 `json:"id" sp:"lineTo(Id)"`
	Uid  string `json:"uid" comment:"标识符" validate:"required" sp:"lineTo(Uid)"`
	Name string `json:"name" comment:"名称" validate:"required"`
}

type ModelBase

type ModelBase struct {
	Id         uint64    `xorm:"autoincr pk unique" json:"id"`
	Uid        string    `xorm:"varchar(36) unique index notnull" json:"uid" sp:"autogen"`
	CreateTime time.Time `xorm:"created index" json:"create_time"`
	UpdateTime time.Time `xorm:"updated" json:"update_time"`
	DeletedAt  time.Time `xorm:"deleted" json:"deleted_at"`
	Version    uint16    `xorm:"version" json:"version"`   //版本号
	Status     uint8     `xorm:"default(0)" json:"status"` // 当前状态 0 正常 其他都不正常
}

func (*ModelBase) BeforeInsert

func (u *ModelBase) BeforeInsert()

type TestModelA

type TestModelA struct {
	Id   uint64 `xorm:"autoincr pk unique" json:"id"`
	Name string `xorm:"varchar(20)" comment:"名称"`
}

func (TestModelA) SpAction added in v1.3.7

func (u TestModelA) SpAction() simple_admin.CustomAction

自定义action

func (*TestModelA) SpAlias added in v1.4.7

func (u *TestModelA) SpAlias() string

func (*TestModelA) SpDeleteAfter added in v1.5.0

func (u *TestModelA) SpDeleteAfter()

func (*TestModelA) SpDeleteBefore added in v1.5.0

func (u *TestModelA) SpDeleteBefore()

func (*TestModelA) SpInsertAfter added in v1.4.3

func (u *TestModelA) SpInsertAfter()

func (*TestModelA) SpInsertBefore added in v1.4.3

func (u *TestModelA) SpInsertBefore()

type TestModelB

type TestModelB struct {
	Id   uint64 `xorm:"autoincr pk unique" json:"id"`
	Desc string `xorm:"varchar(60)"`
}

type TestStructComplexModel

type TestStructComplexModel struct {
	ModelBase `xorm:"extends"`
	Names     string `xorm:"notnull" json:"names"`
	Img       string `xorm:"varchar(255)" sp:"tag(img)"`
}

type TestUserModel

type TestUserModel struct {
	Id       uint64 `xorm:"autoincr pk unique" json:"id"`
	UserName string `xorm:"varchar(60) notnull" json:"user_name"`
	Password string `xorm:"varchar(100) notnull" json:"password"`
	Salt     string `xorm:"varchar(40) notnull" json:"salt"`
	Niubi    string `xorm:"varchar(30)"`
}

Jump to

Keyboard shortcuts

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