summaryrefslogtreecommitdiffstats
path: root/models/repo/mirror.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/repo/mirror.go')
-rw-r--r--models/repo/mirror.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/models/repo/mirror.go b/models/repo/mirror.go
index 5d20b7f833..bd83d24424 100644
--- a/models/repo/mirror.go
+++ b/models/repo/mirror.go
@@ -123,8 +123,8 @@ func MirrorsIterate(limit int, f func(idx int, bean interface{}) error) error {
}
// InsertMirror inserts a mirror to database
-func InsertMirror(mirror *Mirror) error {
- _, err := db.GetEngine(db.DefaultContext).Insert(mirror)
+func InsertMirror(ctx context.Context, mirror *Mirror) error {
+ _, err := db.GetEngine(ctx).Insert(mirror)
return err
}
@@ -168,3 +168,12 @@ func (repos MirrorRepositoryList) loadAttributes(ctx context.Context) error {
func (repos MirrorRepositoryList) LoadAttributes() error {
return repos.loadAttributes(db.DefaultContext)
}
+
+// GetUserMirrorRepositories returns a list of mirror repositories of given user.
+func GetUserMirrorRepositories(userID int64) ([]*Repository, error) {
+ repos := make([]*Repository, 0, 10)
+ return repos, db.GetEngine(db.DefaultContext).
+ Where("owner_id = ?", userID).
+ And("is_mirror = ?", true).
+ Find(&repos)
+}