Skip to content

Commit 7bb2392

Browse files
committed
Rename CrudRepositoryWithContextParameters to ContextCrudRepository, update references and restructure type handling in RepositoryProcessor.
1 parent 3d976fa commit 7bb2392

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

sqlx4k-codegen/src/jvmMain/kotlin/io/github/smyrgeorge/sqlx4k/processor/RepositoryProcessor.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,13 @@ class RepositoryProcessor(
191191
* expected structure, and extracts the associated domain type and mapper information.
192192
*
193193
* This method ensures that the annotated repository interface extends the correct base interface
194-
* (e.g., `CrudRepository` or `CrudRepositoryWithContextParameters`) with a valid domain type parameter. Additionally,
194+
* (e.g., `CrudRepository` or `ContextCrudRepository`) with a valid domain type parameter. Additionally,
195195
* it verifies that the domain type is annotated with `@Table` and that a mapper is explicitly declared within
196196
* the `@Repository` annotation.
197197
*
198198
* @param repo The repository interface represented as a `KSClassDeclaration`. This class declaration must
199199
* be annotated with `@Repository` and implement the appropriate `CrudRepository` interface.
200-
* @param useContextParameters A flag indicating whether the `CrudRepositoryWithContextParameters` interface
200+
* @param useContextParameters A flag indicating whether the `ContextCrudRepository` interface
201201
* is being used instead of the standard `CrudRepository`.
202202
* @return A pair containing the `KSClassDeclaration` of the domain type associated with the repository and
203203
* the fully qualified name of the mapper type specified in the `@Repository` annotation.
@@ -214,10 +214,10 @@ class RepositoryProcessor(
214214
): Pair<KSClassDeclaration, String> {
215215
fun implementsCrudRepository(repo: KSClassDeclaration): KSClassDeclaration {
216216
val repoTypeName =
217-
if (useContextParameters) TypeNames.CRUD_REPOSITORY_WITH_CONTEXT_PARAMETERS
217+
if (useContextParameters) TypeNames.CONTEXT_CRUD_REPOSITORY
218218
else TypeNames.CRUD_REPOSITORY
219219
val repoSimpleName = repoTypeName.substringAfterLast(".")
220-
// find CrudRepository<T> or CrudRepositoryWithContextParameters<T>
220+
// find CrudRepository<T> or ContextCrudRepository<T>
221221
val st = repo.superTypes.map { it.resolve() }
222222
.firstOrNull { it.declaration.qualifiedName() == repoTypeName }
223223
?: error("@Repository interface ${repo.qualifiedName()} must extend $repoTypeName<T>")

sqlx4k-codegen/src/jvmMain/kotlin/io/github/smyrgeorge/sqlx4k/processor/TypeNames.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ object TypeNames {
1313

1414
// Core interfaces/classes
1515
const val CRUD_REPOSITORY = "io.github.smyrgeorge.sqlx4k.CrudRepository"
16-
const val CRUD_REPOSITORY_WITH_CONTEXT_PARAMETERS = "io.github.smyrgeorge.sqlx4k.CrudRepositoryWithContextParameters"
16+
const val CONTEXT_CRUD_REPOSITORY = "io.github.smyrgeorge.sqlx4k.ContextCrudRepository"
1717
const val QUERY_EXECUTOR = "io.github.smyrgeorge.sqlx4k.QueryExecutor"
1818
const val STATEMENT = "io.github.smyrgeorge.sqlx4k.Statement"
1919

sqlx4k/src/commonMain/kotlin/io/github/smyrgeorge/sqlx4k/CrudRepositoryWithContextParameters.kt renamed to sqlx4k/src/commonMain/kotlin/io/github/smyrgeorge/sqlx4k/ContextCrudRepository.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ package io.github.smyrgeorge.sqlx4k
1010
* @param T The type of the entity managed by the repository.
1111
*/
1212
@ExperimentalContextParameters
13-
interface CrudRepositoryWithContextParameters<T> {
13+
interface ContextCrudRepository<T> {
1414
/**
1515
* Inserts the given entity into the data source using the specified driver context.
1616
*

0 commit comments

Comments
 (0)