-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from soil-kt/configuration
Implement a Configuration Class for Compose
- Loading branch information
Showing
31 changed files
with
383 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
soil-query-compose/src/commonMain/kotlin/soil/query/compose/InfiniteQueryConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright 2024 Soil Contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package soil.query.compose | ||
|
||
import androidx.compose.runtime.Immutable | ||
import soil.query.core.Marker | ||
|
||
/** | ||
* Configuration for the infinite query. | ||
* | ||
* @property strategy The strategy for caching query data. | ||
* @property marker The marker with additional information based on the caller of a query. | ||
*/ | ||
@Immutable | ||
data class InfiniteQueryConfig internal constructor( | ||
val strategy: QueryCachingStrategy, | ||
val marker: Marker | ||
) { | ||
|
||
@Suppress("MemberVisibilityCanBePrivate") | ||
class Builder { | ||
var strategy: QueryCachingStrategy = Default.strategy | ||
val marker: Marker = Default.marker | ||
|
||
fun build() = InfiniteQueryConfig( | ||
strategy = strategy, | ||
marker = marker | ||
) | ||
} | ||
|
||
companion object { | ||
val Default = InfiniteQueryConfig( | ||
strategy = QueryCachingStrategy.Default, | ||
marker = Marker.None | ||
) | ||
} | ||
} | ||
|
||
/** | ||
* Creates a [InfiniteQueryConfig] with the provided [initializer]. | ||
*/ | ||
fun InfiniteQueryConfig(initializer: InfiniteQueryConfig.Builder.() -> Unit): InfiniteQueryConfig { | ||
return InfiniteQueryConfig.Builder().apply(initializer).build() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
soil-query-compose/src/commonMain/kotlin/soil/query/compose/MutationConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright 2024 Soil Contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package soil.query.compose | ||
|
||
import androidx.compose.runtime.Immutable | ||
import soil.query.core.Marker | ||
|
||
/** | ||
* Configuration for the mutation. | ||
* | ||
* @property marker The marker with additional information based on the caller of a mutation. | ||
*/ | ||
@Immutable | ||
data class MutationConfig internal constructor( | ||
val marker: Marker | ||
) { | ||
|
||
@Suppress("MemberVisibilityCanBePrivate") | ||
class Builder { | ||
val marker: Marker = Default.marker | ||
|
||
fun build() = MutationConfig( | ||
marker = marker | ||
) | ||
} | ||
|
||
companion object { | ||
val Default = MutationConfig( | ||
marker = Marker.None | ||
) | ||
} | ||
} | ||
|
||
/** | ||
* Creates a [MutationConfig] with the provided [initializer]. | ||
*/ | ||
fun MutationConfig(initializer: MutationConfig.Builder.() -> Unit): MutationConfig { | ||
return MutationConfig.Builder().apply(initializer).build() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
soil-query-compose/src/commonMain/kotlin/soil/query/compose/QueryConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright 2024 Soil Contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package soil.query.compose | ||
|
||
import androidx.compose.runtime.Immutable | ||
import soil.query.core.Marker | ||
|
||
/** | ||
* Configuration for the query. | ||
* | ||
* @property strategy The strategy for caching query data. | ||
* @property marker The marker with additional information based on the caller of a query. | ||
*/ | ||
@Immutable | ||
data class QueryConfig internal constructor( | ||
val strategy: QueryCachingStrategy, | ||
val marker: Marker | ||
) { | ||
|
||
@Suppress("MemberVisibilityCanBePrivate") | ||
class Builder { | ||
var strategy: QueryCachingStrategy = Default.strategy | ||
var marker: Marker = Default.marker | ||
|
||
fun build() = QueryConfig( | ||
strategy = strategy, | ||
marker = marker | ||
) | ||
} | ||
|
||
companion object { | ||
val Default = QueryConfig( | ||
strategy = QueryCachingStrategy.Default, | ||
marker = Marker.None | ||
) | ||
} | ||
} | ||
|
||
/** | ||
* Creates a [QueryConfig] with the provided [initializer]. | ||
*/ | ||
fun QueryConfig(initializer: QueryConfig.Builder.() -> Unit): QueryConfig { | ||
return QueryConfig.Builder().apply(initializer).build() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.