-
Notifications
You must be signed in to change notification settings - Fork 7
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
템플릿 생성, 수정 쿼리 성능 개선 #715
템플릿 생성, 수정 쿼리 성능 개선 #715
Conversation
@@ -13,6 +13,8 @@ public interface TagRepository { | |||
|
|||
Optional<Tag> findByName(String name); | |||
|
|||
List<Tag> findByNameIn(List<String> names); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
다음에 테스트 추가해주세요~!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
짱수 최고!!
List<String> findNameByNamesIn(List<String> names); | ||
|
||
Tag save(Tag tag); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
테스트코드에서만 사용되는 메서드입니다~!
List<String> findNameByNamesIn(List<String> names); | |
Tag save(Tag tag); |
.map(tag -> new TemplateTag(template, tag)) | ||
.toList() | ||
); | ||
List<Tag> existingTags = new ArrayList<>(tagRepository.findByNameIn(tagNames)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
방어적 복사를 하신건가요? 이유가 궁금 ~
나중에 얘기해봐요 왜냐면 전 다 안했거든요 ~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
existingTags
에 새로운 원소를 추가하는 로직이 존재해요.
findByNameIn
의 return 값이 UnmodifiableList
라서 수정 가능한 리스트로 변경해 주는 로직입니다!
List<Tag> existingTags = new ArrayList<>(tagRepository.findByNameIn(tagNames)); | ||
List<String> existNames = existingTags.stream() | ||
.map(Tag::getName) | ||
.toList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
나중에 repository로 부터 name만 받도록 수정해서 커버링 인덱스를 사용해봐요 ~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다.
8280a69
⚡️ 관련 이슈
close #673
📍주요 변경 사항