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

Method clearMoreThanLimit

models/api.go:56–66  ·  view source on GitHub ↗
(uid int)

Source from the content-addressed store, hash-verified

54}
55
56func (m *Auth) clearMoreThanLimit(uid int) {
57 if maxLoginTerminal <= 0 {
58 return
59 }
60 q := orm.NewOrm().QueryTable(m)
61 var auths []Auth
62 q.Filter("uid", uid).OrderBy("-id").Limit(maxLoginTerminal).All(&auths, "id")
63 if len(auths) == maxLoginTerminal {
64 q.Filter("uid", uid).Filter("id__lt", auths[maxLoginTerminal-1].Id).Delete()
65 }
66}
67
68func (m *Auth) GetByToken(token string) (auth Auth) {
69 orm.NewOrm().QueryTable(m).Filter("token", token).One(&auth)

Callers 1

InsertMethod · 0.95

Calls 2

AllMethod · 0.45
DeleteMethod · 0.45

Tested by

no test coverage detected