mirror of
https://github.com/go-gitea/gitea
synced 2025-07-10 04:27:22 +00:00
Remove NewSession method from db.Engine interface (#17577)
* Remove NewSession method from db.Engine interface * Fix bug * Some improvements * Fix bug * Fix test * Use XXXBean instead of XXXExample
This commit is contained in:
@ -105,18 +105,16 @@ func GetLFSLockByID(id int64) (*LFSLock, error) {
|
||||
|
||||
// GetLFSLockByRepoID returns a list of locks of repository.
|
||||
func GetLFSLockByRepoID(repoID int64, page, pageSize int) ([]*LFSLock, error) {
|
||||
sess := db.NewSession(db.DefaultContext)
|
||||
defer sess.Close()
|
||||
|
||||
e := db.GetEngine(db.DefaultContext)
|
||||
if page >= 0 && pageSize > 0 {
|
||||
start := 0
|
||||
if page > 0 {
|
||||
start = (page - 1) * pageSize
|
||||
}
|
||||
sess.Limit(pageSize, start)
|
||||
e.Limit(pageSize, start)
|
||||
}
|
||||
lfsLocks := make([]*LFSLock, 0, pageSize)
|
||||
return lfsLocks, sess.Find(&lfsLocks, &LFSLock{RepoID: repoID})
|
||||
return lfsLocks, e.Find(&lfsLocks, &LFSLock{RepoID: repoID})
|
||||
}
|
||||
|
||||
// CountLFSLockByRepoID returns a count of all LFSLocks associated with a repository.
|
||||
|
Reference in New Issue
Block a user