(userID int64, private bool)
| 1271 | } |
| 1272 | |
| 1273 | func countRepositories(userID int64, private bool) int64 { |
| 1274 | sess := x.Where("id > 0") |
| 1275 | |
| 1276 | if userID > 0 { |
| 1277 | sess.And("owner_id = ?", userID) |
| 1278 | } |
| 1279 | if !private { |
| 1280 | sess.And("is_private=?", false) |
| 1281 | } |
| 1282 | |
| 1283 | count, err := sess.Count(new(Repository)) |
| 1284 | if err != nil { |
| 1285 | log.Error("countRepositories: %v", err) |
| 1286 | } |
| 1287 | return count |
| 1288 | } |
| 1289 | |
| 1290 | // CountRepositories returns number of repositories. |
| 1291 | // Argument private only takes effect when it is false, |
no test coverage detected