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: add initialOffset for OffsetQueryPagingSource #4802

Merged
merged 7 commits into from
Dec 1, 2023
Merged

feat: add initialOffset for OffsetQueryPagingSource #4802

merged 7 commits into from
Dec 1, 2023

Conversation

MohamadJaara
Copy link
Contributor

Introduces initialOffset parameter to OffsetQueryPagingSource, allowing consumers to set a custom starting point. Enhances flexibility and control over data retrieval.

@hfhbd
Copy link
Collaborator

hfhbd commented Nov 14, 2023

@MohamadJaara Please run ./gradlew spotlessApply

@hfhbd
Copy link
Collaborator

hfhbd commented Nov 15, 2023

These changes will break the ABI. Are we okay with it due to the status of this module? Or do we need a binary compatibility overload?

@MohamadJaara
Copy link
Contributor Author

@hfhbd i added new functions with the initial value hopfully this will be fine

@AlecKazakova
Copy link
Collaborator

I assume we want a default param for initialOffset anyways which we could @jvmoverloads to get binary compatibility

@MohamadJaara
Copy link
Contributor Author

MohamadJaara commented Nov 30, 2023

@AlecKazakova do you mean for the OffsetQueryPagingSource class something like

internal class OffsetQueryPagingSource<RowType : Any> @JvmOverloads constructor (
    private val queryProvider: (limit: Int, offset: Int) -> Query<RowType>,
    private val countQuery: Query<Int>,
    private val transacter: TransacterBase,
    private val context: CoroutineContext,
    private val initialOffset: Int = 0,
) : QueryPagingSource<Int, RowType>() {

or for the functions

@Suppress("FunctionName")
@JvmName("QueryPagingSourceInt")
@JvmOverloads
fun <RowType : Any> QueryPagingSource(
  countQuery: Query<Int>,
  transacter: TransacterBase,
  context: CoroutineContext,
  queryProvider: (limit: Int, offset: Int) -> Query<RowType>,
  initialOffset: In = 0,
): PagingSource<Int, RowType> = OffsetQueryPagingSource(
  queryProvider,
  countQuery,
  transacter,
  context,
  initialOffset,
)

@AlecKazakova
Copy link
Collaborator

for ABI compatibility we would need both

@JakeWharton
Copy link
Member

The constructor does not need overloads because nobody except our own code is referencing it.

@AlecKazakova
Copy link
Collaborator

cool, just the methods then

@AlecKazakova AlecKazakova merged commit c966693 into cashapp:master Dec 1, 2023
7 checks passed
AlecKazakova pushed a commit that referenced this pull request Dec 1, 2023
* feat: add initialOffset for OffsetQueryPagingSource

* apply spotless check

* binary compatibility overload

* typo

* add @jvmoverloads for ABI compatibility

* add @jvmoverloads for ABI compatibility
AlecKazakova added a commit that referenced this pull request Dec 1, 2023
* Test against 2023.2

* Update dependency mkdocs-material-extensions to v1.3.1 (#4832)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency com.squareup:kotlinpoet to v1.15.2 (#4855)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Bump sql-psi to 0.5.0 (#4794)

* Bump sql-psi to 0.5.0-SNAPSHOT

* Use published loadFolderFromResources function

* Expose HSQL test-fixtures

* Expose MySql test-fixtures

* Move timber from sql-psi to sqldelight

* Expose Sqlite Json test-fixtures

* Expose Sqlite 3.18 test-fixtures

* Expose Sqlite 3.24 test-fixtures

* Expose Sqlite 3.25 test-fixtures

* Expose Sqlite 3.30 test-fixtures

* Expose Sqlite 3.33 test-fixtures

* Expose Sqlite 3.35 test-fixtures

* Expose Sqlite 3.38 test-fixtures

* Spotless

* Adopt changed sql-psi api

* Add snapshot repo to test snapshot

* Fix Infer between

* Add missing snapshot repo

* Add missing snapshot repo

* Switch to the release version

* Use new loadFolderFromResources shortcut

---------

Co-authored-by: hfhbd <hfhbd@users.noreply.github.com>

* Add TRUNCATE to postgres dialect (#4817)

Co-authored-by: Alec Kazakova <1675456+AlecKazakova@users.noreply.github.com>

* feat: add initialOffset for OffsetQueryPagingSource (#4802)

* feat: add initialOffset for OffsetQueryPagingSource

* apply spotless check

* binary compatibility overload

* typo

* add @jvmoverloads for ABI compatibility

* add @jvmoverloads for ABI compatibility

* Update agp to v8.2.0 (#4861)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update plugin intellij to v1.16.1 (#4862)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Fix compatibility issues

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Philip Wedemann <22521688+hfhbd@users.noreply.github.com>
Co-authored-by: hfhbd <hfhbd@users.noreply.github.com>
Co-authored-by: Bastien de Luca <de-luca@users.noreply.github.com>
Co-authored-by: Mohamad Jaara <jaara.moh@gmail.com>
hfhbd pushed a commit that referenced this pull request Apr 2, 2024
* feat: add initialOffset for OffsetQueryPagingSource

* apply spotless check

* binary compatibility overload

* typo

* add @jvmoverloads for ABI compatibility

* add @jvmoverloads for ABI compatibility
hfhbd added a commit that referenced this pull request Apr 2, 2024
* Test against 2023.2

* Update dependency mkdocs-material-extensions to v1.3.1 (#4832)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency com.squareup:kotlinpoet to v1.15.2 (#4855)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Bump sql-psi to 0.5.0 (#4794)

* Bump sql-psi to 0.5.0-SNAPSHOT

* Use published loadFolderFromResources function

* Expose HSQL test-fixtures

* Expose MySql test-fixtures

* Move timber from sql-psi to sqldelight

* Expose Sqlite Json test-fixtures

* Expose Sqlite 3.18 test-fixtures

* Expose Sqlite 3.24 test-fixtures

* Expose Sqlite 3.25 test-fixtures

* Expose Sqlite 3.30 test-fixtures

* Expose Sqlite 3.33 test-fixtures

* Expose Sqlite 3.35 test-fixtures

* Expose Sqlite 3.38 test-fixtures

* Spotless

* Adopt changed sql-psi api

* Add snapshot repo to test snapshot

* Fix Infer between

* Add missing snapshot repo

* Add missing snapshot repo

* Switch to the release version

* Use new loadFolderFromResources shortcut

---------

Co-authored-by: hfhbd <hfhbd@users.noreply.github.com>

* Add TRUNCATE to postgres dialect (#4817)

Co-authored-by: Alec Kazakova <1675456+AlecKazakova@users.noreply.github.com>

* feat: add initialOffset for OffsetQueryPagingSource (#4802)

* feat: add initialOffset for OffsetQueryPagingSource

* apply spotless check

* binary compatibility overload

* typo

* add @jvmoverloads for ABI compatibility

* add @jvmoverloads for ABI compatibility

* Update agp to v8.2.0 (#4861)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update plugin intellij to v1.16.1 (#4862)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Fix compatibility issues

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Philip Wedemann <22521688+hfhbd@users.noreply.github.com>
Co-authored-by: hfhbd <hfhbd@users.noreply.github.com>
Co-authored-by: Bastien de Luca <de-luca@users.noreply.github.com>
Co-authored-by: Mohamad Jaara <jaara.moh@gmail.com>
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.

None yet

4 participants