mirror of
https://github.com/harness/drone.git
synced 2025-05-31 11:43:15 +00:00
Merge branch 'jobatzil/misc/fixcount' of _OKE5H2PQKOUfzFFDuD4FA/default/CODE/gitness (#347)
This commit is contained in:
commit
9cd7677efa
@ -239,7 +239,7 @@ func (s *pipelineStore) Count(ctx context.Context, parentID int64, filter types.
|
||||
Where("pipeline_space_id = ?", parentID)
|
||||
|
||||
if filter.Query != "" {
|
||||
stmt = stmt.Where("pipeline_uid LIKE ?", fmt.Sprintf("%%%s%%", filter.Query))
|
||||
stmt = stmt.Where("LOWER(pipeline_uid) LIKE ?", fmt.Sprintf("%%%s%%", strings.ToLower(filter.Query)))
|
||||
}
|
||||
|
||||
sql, args, err := stmt.ToSql()
|
||||
|
@ -407,6 +407,10 @@ func (s *PullReqStore) Count(ctx context.Context, opts *types.PullReqFilter) (in
|
||||
stmt = stmt.Where("pullreq_target_branch = ?", opts.TargetBranch)
|
||||
}
|
||||
|
||||
if opts.Query != "" {
|
||||
stmt = stmt.Where("LOWER(pullreq_title) LIKE ?", fmt.Sprintf("%%%s%%", strings.ToLower(opts.Query)))
|
||||
}
|
||||
|
||||
if opts.CreatedBy != 0 {
|
||||
stmt = stmt.Where("pullreq_created_by = ?", opts.CreatedBy)
|
||||
}
|
||||
@ -459,7 +463,7 @@ func (s *PullReqStore) List(ctx context.Context, opts *types.PullReqFilter) ([]*
|
||||
stmt = stmt.Where("LOWER(pullreq_title) LIKE ?", fmt.Sprintf("%%%s%%", strings.ToLower(opts.Query)))
|
||||
}
|
||||
|
||||
if opts.CreatedBy > 0 {
|
||||
if opts.CreatedBy != 0 {
|
||||
stmt = stmt.Where("pullreq_created_by = ?", opts.CreatedBy)
|
||||
}
|
||||
|
||||
|
@ -257,7 +257,7 @@ func (s *RepoStore) Count(ctx context.Context, parentID int64, opts *types.RepoF
|
||||
Where("repo_parent_id = ?", parentID)
|
||||
|
||||
if opts.Query != "" {
|
||||
stmt = stmt.Where("repo_uid LIKE ?", fmt.Sprintf("%%%s%%", opts.Query))
|
||||
stmt = stmt.Where("LOWER(repo_uid) LIKE ?", fmt.Sprintf("%%%s%%", strings.ToLower(opts.Query)))
|
||||
}
|
||||
|
||||
sql, args, err := stmt.ToSql()
|
||||
|
@ -247,7 +247,7 @@ func (s *secretStore) Count(ctx context.Context, parentID int64, filter types.Li
|
||||
Where("secret_space_id = ?", parentID)
|
||||
|
||||
if filter.Query != "" {
|
||||
stmt = stmt.Where("secret_uid LIKE ?", fmt.Sprintf("%%%s%%", filter.Query))
|
||||
stmt = stmt.Where("LOWER(secret_uid) LIKE ?", fmt.Sprintf("%%%s%%", strings.ToLower(filter.Query)))
|
||||
}
|
||||
|
||||
sql, args, err := stmt.ToSql()
|
||||
|
@ -264,6 +264,10 @@ func (s *WebhookStore) Count(ctx context.Context, parentType enum.WebhookParent,
|
||||
return 0, fmt.Errorf("webhook parent type '%s' is not supported", parentType)
|
||||
}
|
||||
|
||||
if opts.Query != "" {
|
||||
stmt = stmt.Where("LOWER(webhook_display_name) LIKE ?", fmt.Sprintf("%%%s%%", strings.ToLower(opts.Query)))
|
||||
}
|
||||
|
||||
sql, args, err := stmt.ToSql()
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("failed to convert query to sql: %w", err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user