Documentation
¶
Index ¶
- func CheckParentHas[T any](d *gorm.DB, id uint, parentID uint) bool
- func FormatData[T any](data []T, call func(item *T, index int) map[string]any, page *Pagination) ([]map[string]any, map[string]any)
- func GetTableName(db *gorm.DB, model any) string
- func Paginate(pagination *Pagination) func(db *gorm.DB) *gorm.DB
- func ParentPreload(d *gorm.DB) *gorm.DB
- func QueryParentIDs(model any, id uint, db *gorm.DB) ([]uint, error)
- func QuerySubIDs(model any, id uint, db *gorm.DB) ([]uint, error)
- func TreeBreadcrumb(parent any, key string) []string
- func TreePreload(config TreePreloadConfig) func(d *gorm.DB) *gorm.DB
- func TreeSort(db *gorm.DB, model any, id uint64, beforeId uint64, parentId uint64) error
- type Fields
- type ID
- type LogLogin
- type LogOperate
- type LogVisit
- type LogVisitData
- type LogVisitSpider
- type Pagination
- type SoftDeletes
- type Timestamps
- type TreePreloadConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatData ¶
func TreeBreadcrumb ¶
func TreePreload ¶
func TreePreload(config TreePreloadConfig) func(d *gorm.DB) *gorm.DB
Types ¶
type LogLogin ¶
type LogLogin struct {
Fields
UserType string `gorm:"size:250;comment:关联类型" json:"user_type"`
UserId uint `gorm:"size:20;comment:关联 id" json:"user_id"`
Browser string `gorm:"size:250;comment:浏览器" json:"browser"`
Ip string `gorm:"size:100;comment:IP" json:"ip"`
Platform string `gorm:"size:100;comment:平台" json:"platform"`
Status *bool `gorm:"default:1" json:"status"`
}
LogLogin @AutoMigrate()
type LogOperate ¶
type LogOperate struct {
Fields
UserType string `gorm:"size:250;comment:关联类型" json:"user_type"`
UserID uint `gorm:"size:20;comment:关联 id" json:"user_id"`
RequestMethod string `gorm:"size:50;comment:请求方法" json:"request_method"`
RequestUrl string `gorm:"size:250;comment:请求链接" json:"request_url"`
RequestParams datatypes.JSON `gorm:"comment:请求链接" json:"request_params"`
RequestTime float64 `gorm:"type:decimal(11,2);comment:访客量" json:"request_time"`
RouteName string `gorm:"size:50;comment:关联类型" json:"route_name"`
RouteTitle string `gorm:"size:50;comment:关联标题" json:"route_title"`
ClientUa string `gorm:"size:250;comment:UA" json:"client_ua"`
ClientIp string `gorm:"size:100;comment:IP" json:"client_ip"`
ClientBrowser string `gorm:"size:250;comment:浏览器" json:"client_browser"`
ClientDevice string `gorm:"size:250;comment:设备" json:"client_device"`
}
type LogVisit ¶
type LogVisit struct {
Fields
HasType string `gorm:"size:250;comment:关联类型" json:"has_type"`
HasId uint `gorm:"size:20;comment:关联 id" json:"has_id"`
Pv uint `gorm:"default:1;comment:访问量" json:"pv"`
Uv uint `gorm:"default:1;comment:访客量" json:"uv"`
}
LogVisit @AutoMigrate()
type LogVisitData ¶
type LogVisitData struct {
Fields
Date carbon.Date `gorm:"type:date;comment:日期" json:"date"`
HasType string `gorm:"size:250;comment:关联类型" json:"has_type"`
HasId uint `gorm:"size:20;comment:关联 id" json:"has_id"`
UUID string `gorm:"size:250;comment:唯一标识" json:"uuid"`
Driver string `gorm:"size:250;comment:设备" json:"driver"`
Ip string `gorm:"size:100;comment:IP" json:"ip"`
Browser string `gorm:"size:250;comment:浏览器" json:"browser"`
Country string `gorm:"size:100;comment:国家" json:"country"`
Province string `gorm:"size:100;comment:省份" json:"province"`
City string `gorm:"size:100;comment:城市" json:"city"`
Num uint `gorm:"size:100;default:0;comment:PV" json:"num"`
}
LogVisitData @AutoMigrate()
type LogVisitSpider ¶
type LogVisitSpider struct {
Fields
Date carbon.Date `gorm:"type:date;comment:日期" json:"date"`
HasType string `gorm:"size:250;comment:关联类型" json:"has_type"`
HasId uint `gorm:"size:20;comment:关联 id" json:"has_id"`
Name string `gorm:"size:250;comment:蜘蛛名" json:"name"`
Path string `gorm:"size:250;comment:页面路径" json:"path"`
Num uint `gorm:"default:0;comment:访客量" json:"num"`
}
LogVisitSpider @AutoMigrate()
type Pagination ¶
type Pagination struct {
PageSize int `json:"pageSize,omitempty"`
Page int `json:"page,omitempty"`
Total int64 `json:"total"`
Pages int `json:"pages"`
}
func NewPagination ¶
func NewPagination(page, pageSize int) *Pagination
func (*Pagination) GetLimit ¶
func (p *Pagination) GetLimit() int
func (*Pagination) GetOffset ¶
func (p *Pagination) GetOffset() int
func (*Pagination) GetPage ¶
func (p *Pagination) GetPage() int
type SoftDeletes ¶
type Timestamps ¶
type TreePreloadConfig ¶
Click to show internal directories.
Click to hide internal directories.