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

feat: support stream in spring data repository #803

Merged
merged 2 commits into from
Dec 17, 2024
Merged

Conversation

shouwn
Copy link
Member

@shouwn shouwn commented Dec 9, 2024

Motivation

  • Spring Data supports a stream as a return type.

Modifications

  • Add the findStream() functions to make the stream available in the repository.

Result

employeeRepository.findStream {
    selectNew<Row>(
        path(EmployeeDepartment::departmentId),
        count(Employee::employeeId),
    ).from(
        entity(Employee::class),
        join(Employee::departments),
    ).groupBy(
        path(EmployeeDepartment::departmentId),
    ).orderBy(
        path(EmployeeDepartment::departmentId).asc(),
    )
}

@codecov-commenter
Copy link

codecov-commenter commented Dec 9, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 8 lines in your changes missing coverage. Please review.

Project coverage is 90.54%. Comparing base (3a58ff8) to head (2f2835f).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...ata/jpa/javax/repository/KotlinJdslJpqlExecutor.kt 33.33% 4 Missing ⚠️
...ring/data/jpa/repository/KotlinJdslJpqlExecutor.kt 33.33% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #803      +/-   ##
==========================================
- Coverage   90.69%   90.54%   -0.16%     
==========================================
  Files         337      337              
  Lines        3536     3564      +28     
  Branches      221      221              
==========================================
+ Hits         3207     3227      +20     
- Misses        261      269       +8     
  Partials       68       68              

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

Copy link
Collaborator

@cj848 cj848 left a comment

Choose a reason for hiding this comment

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

I didn't think about the part where offset, limit are given as optional or the part where pageable is included, but I'm impressed by your meticulousness. This is LGTM.

But if you look at the PR result, it says findAll. It looks like a typo, but is it correct?

--- korean
offset, limit 을 optional 로 주는 부분이나 pageable 들어가는 부분은 생각 못했었는데 꼼꼼함에 감탄합니다 ㅎㅎ LGTM 입니다.

그런데 PR result 쪽에 보면 findAll로 되어있네요. 오타로 보이는데 맞을까요?

@cj848
Copy link
Collaborator

cj848 commented Dec 9, 2024

And if possible, it would be nice to also add a gitbook manual.

--- korean
그리고 가능하다면 gitbook 메뉴얼도 추가되면 좋을것 같습니다.

@shouwn shouwn requested a review from cj848 December 17, 2024 07:14
@cj848 cj848 merged commit 7556c84 into main Dec 17, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do you support Stream Query? (Stream 쿼리를 지원하나요?)
3 participants