@@ -81,9 +81,7 @@ func (branches BranchList) LoadRepo(ctx context.Context) error {
81
81
type FindBranchOptions struct {
82
82
db.ListOptions
83
83
RepoID int64
84
- RepoCond builder.Cond
85
84
ExcludeBranchNames []string
86
- CommitCond builder.Cond
87
85
PusherID int64
88
86
IsDeletedBranch optional.Option [bool ]
89
87
CommitAfterUnix int64
@@ -98,34 +96,27 @@ func (opts FindBranchOptions) ToConds() builder.Cond {
98
96
if opts .RepoID > 0 {
99
97
cond = cond .And (builder.Eq {"repo_id" : opts .RepoID })
100
98
}
101
- if opts .RepoCond != nil {
102
- cond = cond .And (opts .RepoCond )
103
- }
104
99
105
100
if len (opts .ExcludeBranchNames ) > 0 {
106
- cond = cond .And (builder .NotIn ("branch.name" , opts .ExcludeBranchNames ))
107
- }
108
-
109
- if opts .CommitCond != nil {
110
- cond = cond .And (opts .CommitCond )
101
+ cond = cond .And (builder .NotIn ("name" , opts .ExcludeBranchNames ))
111
102
}
112
103
113
104
if opts .PusherID > 0 {
114
- cond = cond .And (builder.Eq {"branch. pusher_id" : opts .PusherID })
105
+ cond = cond .And (builder.Eq {"pusher_id" : opts .PusherID })
115
106
}
116
107
117
108
if opts .IsDeletedBranch .Has () {
118
- cond = cond .And (builder.Eq {"branch. is_deleted" : opts .IsDeletedBranch .Value ()})
109
+ cond = cond .And (builder.Eq {"is_deleted" : opts .IsDeletedBranch .Value ()})
119
110
}
120
111
if opts .Keyword != "" {
121
112
cond = cond .And (builder.Like {"name" , opts .Keyword })
122
113
}
123
114
124
115
if opts .CommitAfterUnix != 0 {
125
- cond = cond .And (builder.Gte {"branch. commit_time" : opts .CommitAfterUnix })
116
+ cond = cond .And (builder.Gte {"commit_time" : opts .CommitAfterUnix })
126
117
}
127
118
if opts .CommitBeforeUnix != 0 {
128
- cond = cond .And (builder.Lte {"branch. commit_time" : opts .CommitBeforeUnix })
119
+ cond = cond .And (builder.Lte {"commit_time" : opts .CommitBeforeUnix })
129
120
}
130
121
131
122
return cond
0 commit comments