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

implement SliceableRepository #6

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

katagiri-kazumune
Copy link
Collaborator

概要

#2

classmethod/spar-wings#6 の対応済みの spar-wings が必要

内容

SliceableRepository#findAll や
メソッドの戻り値に Slice を指定したメソッドに対して
Slice 形式の結果を返す

  • DefaultMirageRepository
    • SliceableRepository#findAll の実装
  • MirageQuery
    • メソッドの戻り値が Slice になっている場合の処理を実装
      • 元々似たような処理は存在しており、Spring 側の Pageable を受けるようになっていたが対応も中途半端だったので変更した

@@ -18,7 +18,7 @@
<logger name="org.springframework" level="INFO" />
<logger name="jp.xet.springframework.data.mirage" level="DEBUG" />

<logger name="com.miragesql.miragesql" level="WARN" />
<logger name="com.miragesql.miragesql" level="DEBUG" />
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

test 時は 発行する SQL が見えた方が良いと思われた

Copy link
Contributor

@inabajunmr inabajunmr left a comment

Choose a reason for hiding this comment

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

nitsのみ

Class<?> returnedDomainType, SliceableParameterAccessor accessor) {
Sliceable sliceable = accessor.getSliceable();
if (sliceable != null) {
addSliceParam(parameterMap, sliceable);
} else if (accessor.getSort() != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

このアクセサからソートが取得できたときのsortなんですが、sliceableがなかった時のelseの場合だけ適用されるの中途半端な気がしていて、sliceableでかつsort、みたいなことができないのであればとりあえずこのsliceableがなかったらsort、はなくてもよいかなと思いました(なんか違う意図があったら教えてもらえると)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

消しました(多分 Sort パラメータの存在を知ってる人はいない)
26bf016

/**
* SliceableRepository のメソッド定義無し.
*/
public interface TaskRepository extends WritableRepository<Task, String>, SliceableRepository<Task, String> {
Copy link
Contributor

Choose a reason for hiding this comment

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

なんとなくTaskSliceableRepositoryのが規則性がある感じがしました

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

修正しました
26bf016

@katagiri-kazumune
Copy link
Collaborator Author

@inabajunmr
https://github.com/classmethod/cmapi-five-rings/pull/47#discussion_r399915846
の spring-data-mirage 側の処理が
eb2386d
です。

@katagiri-kazumune katagiri-kazumune added this to the 0.14.4.RELEASE milestone Jul 28, 2020
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.

2 participants