mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-05 04:05:32 +02:00
Simplify
- Drop lazy LoadRepo/LoadOwner in convert.ToProject; rely on caller preloading. ListProjects sets Repo from ctx.Repo.Repository on each project; CreateProject does the same on the new project. Avoids N+1 queries for repo-scoped list endpoints. - Strip redundant API struct field comments that just restate the field name; keep the ones that document enum values. - Pre-allocate GetColumnsByIDs result slice with len(columnsIDs). - Fix CountProjectColumns doc comment (was "CountColumns"). Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,7 @@ import (
|
||||
"code.gitea.io/gitea/models/db"
|
||||
)
|
||||
|
||||
// CountColumns returns the total number of columns for a project
|
||||
// CountProjectColumns returns the total number of columns for a project
|
||||
func CountProjectColumns(ctx context.Context, projectID int64) (int64, error) {
|
||||
return db.GetEngine(ctx).Where("project_id=?", projectID).Count(&Column{})
|
||||
}
|
||||
@@ -28,7 +28,7 @@ func GetProjectColumns(ctx context.Context, projectID int64, opts db.ListOptions
|
||||
}
|
||||
|
||||
func GetColumnsByIDs(ctx context.Context, projectID int64, columnsIDs []int64) (ColumnList, error) {
|
||||
columns := make([]*Column, 0, 5)
|
||||
columns := make([]*Column, 0, len(columnsIDs))
|
||||
if len(columnsIDs) == 0 {
|
||||
return columns, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user