MCPcopy Index your code
hub / github.com/TruthHun/BookStack / FindToPager

Method FindToPager

models/label.go:69–87  ·  view source on GitHub ↗

分页查找标签.

(pageIndex, pageSize int, word ...string)

Source from the content-addressed store, hash-verified

67
68//分页查找标签.
69func (m *Label) FindToPager(pageIndex, pageSize int, word ...string) (labels []*Label, totalCount int, err error) {
70 var count int64
71 o := orm.NewOrm()
72 q := o.QueryTable(m.TableNameWithPrefix()).OrderBy("-book_number")
73 if len(word) > 0 {
74 q = q.Filter("label_name__icontains", word[0])
75 }
76 count, err = q.Count()
77 if err != nil {
78 return
79 }
80 totalCount = int(count)
81
82 offset := (pageIndex - 1) * pageSize
83
84 _, err = q.Offset(offset).Limit(pageSize).All(&labels)
85
86 return
87}

Callers

nothing calls this directly

Calls 3

TableNameWithPrefixMethod · 0.95
CountMethod · 0.45
AllMethod · 0.45

Tested by

no test coverage detected