model

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: May 26, 2020 License: MIT Imports: 3 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"`
}

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 {
	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)"`
}

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"`
}

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