-
Notifications
You must be signed in to change notification settings - Fork 1
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
[π Feature] νμ λΌμΈμ© λͺ©ν μ‘°ν API κ°λ° - Pagination λ°©μ offset κΈ°λ°μΌλ‘ λ³κ²½ #243
Changes from 17 commits
b99367c
4249f81
854f4a2
23aa5f9
1c7d46f
74b372b
54c8b81
ef9f69d
30b557b
89264c7
5425558
48e2709
a9135a1
63bb7e9
4c110bc
bb151c4
0a00a11
4f8d56b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
package io.raemian.api.goal.controller.request | ||
|
||
import java.time.LocalDateTime | ||
|
||
data class TimelinePageRequest( | ||
val cursor: LocalDateTime?, | ||
val size: Int, | ||
val page: Int = 0, | ||
val size: Int = 20, | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package io.raemian.api.support.response | ||
|
||
data class OffsetPaginationResult<T>( | ||
val total: Long, | ||
val page: Int, | ||
val size: Int, | ||
val contents: List<T>, | ||
) { | ||
companion object { | ||
fun <T> of(page: Int, size: Int, total: Long, contents: List<T>): OffsetPaginationResult<T> { | ||
return OffsetPaginationResult(total, page, size, contents) | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package io.raemian.storage.db.core.common.pagination | ||
|
||
interface CursorExtractable<CursorType> { | ||
fun cursorId(): CursorType | ||
interface CursorExtractable { | ||
fun cursorId(): Long | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,13 @@ package io.raemian.storage.db.core.common.pagination | |
|
||
import java.util.function.Function | ||
|
||
data class CursorPaginationResult<CursorType, T> internal constructor( | ||
data class PaginationResult<T> internal constructor( | ||
val contents: List<T>, | ||
val nextCursor: CursorType?, | ||
val nextCursor: Long?, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nextκ° μλ κ²½μ°λ 첫νμ΄μ§λ₯Ό λ»νλ건κ°? λ§μ½ 첫νμ΄μ§λΌλ©΄ LONG MAX(MIN) VALUE μ ν λΉνλ건 μ΄λ¨κΉ? μ΅λν null μ νμ©νμ§ μλ λ°©ν₯μΌλ‘κ°λκ² μ’μκ²κ°μ~~ null μ΄ λ€μ΄κ°λ κ²½μ°λΌλ©΄ μ΄μ©μμκ³ γ γ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. νμ¬ pagination μμ²μ κ²°κ³Όκ° λ§μ§λ§ νμ΄μ§μΌ κ²½μ°(isLast = true) nextCursorλ₯Ό nullλ‘ λ³΄λ΄κ³ μλ μν©μ
λλ€! |
||
val isLast: Boolean, | ||
) { | ||
fun <R> transform(transformer: Function<T, R>): CursorPaginationResult<CursorType, R> { | ||
return CursorPaginationResult( | ||
fun <R> transform(transformer: Function<T, R>): PaginationResult<R> { | ||
return PaginationResult( | ||
contents.stream().map(transformer).toList(), | ||
nextCursor, | ||
isLast, | ||
|
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.
μ!!! γ γ γ γ γ γ
κ°μ¬ν©λλ€ π