Small refactor to reduce unnecessary database queries and remove duplicated functions (#33779)

This commit is contained in:
Lunny Xiao
2025-03-04 10:25:20 -08:00
committed by GitHub
parent 75e85c25c1
commit 6c8fb8d455
10 changed files with 32 additions and 12 deletions

View File

@ -336,6 +336,9 @@ func UpdateColumnSorting(ctx context.Context, cl ColumnList) error {
func GetColumnsByIDs(ctx context.Context, projectID int64, columnsIDs []int64) (ColumnList, error) {
columns := make([]*Column, 0, 5)
if len(columnsIDs) == 0 {
return columns, nil
}
if err := db.GetEngine(ctx).
Where("project_id =?", projectID).
In("id", columnsIDs).