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

Method DeleteByDocumentId

models/document_history.go:168–179  ·  view source on GitHub ↗

根据文档id删除记录

(docId int)

Source from the content-addressed store, hash-verified

166
167// 根据文档id删除记录
168func (history *DocumentHistory) DeleteByDocumentId(docId int) (err error) {
169 var histories []DocumentHistory
170 o := orm.NewOrm()
171 filter := o.QueryTable(history.TableNameWithPrefix()).Filter("document_id", docId)
172 filter.All(&histories)
173 for _, item := range histories {
174 ver := NewVersionControl(docId, item.Version)
175 ver.DeleteVersion() //删除版本文件
176 }
177 _, err = filter.Delete()
178 return
179}
180
181// 根据history id 删除记录
182func (history *DocumentHistory) DeleteByHistoryId(historyId int) (err error) {

Callers 2

ClearMethod · 0.95
ThoroughDeleteBookMethod · 0.95

Calls 5

TableNameWithPrefixMethod · 0.95
NewVersionControlFunction · 0.85
AllMethod · 0.45
DeleteVersionMethod · 0.45
DeleteMethod · 0.45

Tested by

no test coverage detected