Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: add builder for list options #6148

Merged
merged 1 commit into from
Jun 26, 2024

Conversation

guqing
Copy link
Member

@guqing guqing commented Jun 26, 2024

What type of PR is this?

/kind improvement
/area core
/milestone 2.17.x

What this PR does / why we need it:

为 ListOptions 增加 Builder 以方便构建 ListOptions 对象,可以通过以下形式创建

var listOptions = ListOptions.builder()
                .labelSelector()// 构建 LabelSelector
                .eq("key-1", "value-1")
                .notEq("key-2", "value-1")
                .exists("key-3")
                .end()// 结束构建 LabelSelector
                .fieldQuery(equal("spec.title", "fake-title"))  // 构建 FieldSelector
                .andQuery(equal("spec.slug", "fake-slug"))
                .orQuery(equal("spec.slug", "test"))
                .build();

Does this PR introduce a user-facing change?

开发者相关:支持通过 Builder 来简化 ListOptions 的构建

@f2c-ci-robot f2c-ci-robot bot added release-note-none Denotes a PR that doesn't merit a release note. kind/improvement Categorizes issue or PR as related to a improvement. labels Jun 26, 2024
@f2c-ci-robot f2c-ci-robot bot added this to the 2.17.x milestone Jun 26, 2024
@f2c-ci-robot f2c-ci-robot bot added the area/core Issues or PRs related to the Halo Core label Jun 26, 2024
@f2c-ci-robot f2c-ci-robot bot requested review from ruibaby and wan92hen June 26, 2024 04:39
@f2c-ci-robot f2c-ci-robot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Jun 26, 2024
Copy link

codecov bot commented Jun 26, 2024

Codecov Report

Attention: Patch coverage is 57.62712% with 25 lines in your changes missing coverage. Please review.

Project coverage is 55.13%. Comparing base (5fdf6c0) to head (0358fad).
Report is 265 commits behind head on main.

Files Patch % Lines
.../main/java/run/halo/app/extension/ListOptions.java 56.75% 11 Missing and 5 partials ⚠️
...o/app/extension/router/selector/LabelSelector.java 57.89% 7 Missing and 1 partial ⚠️
...halo/app/extension/router/selector/SetMatcher.java 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6148      +/-   ##
============================================
- Coverage     56.91%   55.13%   -1.78%     
- Complexity     3319     3458     +139     
============================================
  Files           587      629      +42     
  Lines         18968    21234    +2266     
  Branches       1401     1491      +90     
============================================
+ Hits          10795    11707     +912     
- Misses         7594     8924    +1330     
- Partials        579      603      +24     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@ruibaby ruibaby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Jun 26, 2024
Copy link
Member

@JohnNiang JohnNiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Copy link

f2c-ci-robot bot commented Jun 26, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JohnNiang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 26, 2024
@f2c-ci-robot f2c-ci-robot bot merged commit 50f751d into halo-dev:main Jun 26, 2024
7 checks passed
@ruibaby ruibaby modified the milestones: 2.17.x, 2.17.0 Jun 26, 2024
f2c-ci-robot bot pushed a commit to halo-dev/docs that referenced this pull request Jul 2, 2024
### What this PR does?
添加 ListOptions builder 的文档说明

see also halo-dev/halo#6148

```release-note
None
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/core Issues or PRs related to the Halo Core kind/improvement Categorizes issue or PR as related to a improvement. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants