models

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseModel

type BaseModel struct {
	ID        uint            `gorm:"primarykey" json:"id"`             // 数据ID
	CreatedAt time.Time       `gorm:"type:datetime;" json:"created_at"` // 数据创建时间
	UpdatedAt time.Time       `gorm:"type:datetime;" json:"updated_at"` // 数据更新时间
	DeletedAt *gorm.DeletedAt `gorm:"type:datetime;index;" json:"-"`    // 数据删除时间
}

数据模型基本字段

type DelIds

type DelIds struct {
	Ids []uint `json:"ids" form:"ids"`
}

删除数据

type PageInfo

type PageInfo struct {
	IsNotPaging bool  `json:"isNotPaging" form:"isNotPaging"` // 是否分页
	PageNum     int64 `json:"pageNum" form:"pageNum"`         // 页数
	PageSize    int64 `json:"pageSize" form:"pageSize"`       // 页码
	Total       int64 `json:"total"`                          // 总数  由服务器返回回去
}

数据分页

func (*PageInfo) GetLimit

func (s *PageInfo) GetLimit() (int, int)

GetLimit 计算limit/offset, 如果需要用到返回的PageSize, PageNum, 务必保证Total值有效

Jump to

Keyboard shortcuts

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