Skip to content

Commit

Permalink
chore: Update hint about the breaking changes in Entity transform API
Browse files Browse the repository at this point in the history
  • Loading branch information
obabichevjb committed Oct 2, 2024
1 parent 232d4a3 commit ce39d44
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 6 deletions.
26 changes: 26 additions & 0 deletions documentation-website/Writerside/topics/Breaking-Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,32 @@ TestTable.upsert(
exception handler wrapping the inner transaction, and any inner commits will not be saved. In version 0.55.0, this change will be reduced
so that only inner transactions that throw an `SQLException` from the database will trigger such a rollback.

## 0.53.0

* DAO Entity Transformation Changes
* **Parameter Renaming**: `transform()` and `memoizedTransform()` now use `wrap` and `unwrap` instead of `toColumn` and `toReal`.
```kotlin
// Old:
var name by EmployeeTable.name.transform(toColumn = { it.uppercase() }, toReal = { it.lowercase() })
// New:
var name by EmployeeTable.name.transform(wrap = { it.uppercase() }, unwrap = { it.lowercase() })
```
* **Class Renaming**: `ColumnWithTransform` is now `EntityFieldWithTransform`, consolidating properties into a single `transformer`.
```kotlin
EntityFieldWithTransform(column, object : ColumnTransformer<String, Int> {
override fun unwrap(value: Int): String = value.toString()
override fun wrap(value: String): Int = value.toInt()
})
```
* Entity transformation via DAO is deprecated and should be replaced with DSL transformation.
```kotlin
val tester = object : Table() {
val value = integer("value")
.transform(wrap = { ... }, unwrap = { ... })
}
```


## 0.51.0

* The `exposed-spring-boot-starter` module no longer provides the entire [spring-boot-starter-data-jdbc](https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jdbc) module.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,9 @@ abstract class EntityClass<ID : Comparable<ID>, out T : Entity<ID>>(
"DAOs transform() is deprecated and will be removed in future releases. " +
"Please use the transform function from the DSL layer. " +
"Please log a request on YouTrack (https://youtrack.jetbrains.com/newIssue?project=EXPOSED) " +
"if a use-case cannot be sufficiently covered by the DSL transform().",
"if a use-case cannot be sufficiently covered by the DSL transform(). " +
"With version 0.53.0 Entity transformation got several breaking changes. " +
"Check related PR (https://github.com/JetBrains/Exposed/pull/2143) for more details.",
ReplaceWith(
"object : Table() { val c = column().transform(transformer) }"
)
Expand All @@ -764,7 +766,9 @@ abstract class EntityClass<ID : Comparable<ID>, out T : Entity<ID>>(
"DAOs transform() is deprecated and will be removed in future releases. " +
"Please use the transform function from the DSL layer. " +
"Please log a request on YouTrack (https://youtrack.jetbrains.com/newIssue?project=EXPOSED) " +
"if a use-case cannot be sufficiently covered by the DSL transform().",
"if a use-case cannot be sufficiently covered by the DSL transform(). " +
"With version 0.53.0 Entity transformation got several breaking changes. " +
"Check related PR (https://github.com/JetBrains/Exposed/pull/2143) for more details.",
ReplaceWith(
"object : Table() { val c = column().transform(wrap, unwrap) }"
)
Expand All @@ -787,7 +791,9 @@ abstract class EntityClass<ID : Comparable<ID>, out T : Entity<ID>>(
"DAOs transform() is deprecated and will be removed in future releases. " +
"Please use the transform function from the DSL layer. " +
"Please log a request on YouTrack (https://youtrack.jetbrains.com/newIssue?project=EXPOSED) " +
"if a use-case cannot be sufficiently covered by the DSL transform().",
"if a use-case cannot be sufficiently covered by the DSL transform(). " +
"With version 0.53.0 Entity transformation got several breaking changes. " +
"Check related PR (https://github.com/JetBrains/Exposed/pull/2143) for more details.",
ReplaceWith(
"object : Table() { val c = column().transform(wrap, unwrap) }"
)
Expand All @@ -812,7 +818,9 @@ abstract class EntityClass<ID : Comparable<ID>, out T : Entity<ID>>(
"Please use the transform function from the DSL layer. " +
"Memoization will not be a part of column transformation API anymore. " +
"Please log a request on YouTrack (https://youtrack.jetbrains.com/newIssue?project=EXPOSED) " +
"if a use-case cannot be sufficiently covered by the DSL transform().",
"if a use-case cannot be sufficiently covered by the DSL transform(). " +
"With version 0.53.0 Entity transformation got several breaking changes. " +
"Check related PR (https://github.com/JetBrains/Exposed/pull/2143) for more details.",
ReplaceWith(
"object : Table() { val c = column().transform(transformer) }"
)
Expand All @@ -837,7 +845,9 @@ abstract class EntityClass<ID : Comparable<ID>, out T : Entity<ID>>(
"Please use the transform function from the DSL layer. " +
"Memoization will not be a part of column transformation API anymore. " +
"Please log a request on YouTrack (https://youtrack.jetbrains.com/newIssue?project=EXPOSED) " +
"if a use-case cannot be sufficiently covered by the DSL transform().",
"if a use-case cannot be sufficiently covered by the DSL transform(). " +
"With version 0.53.0 Entity transformation got several breaking changes. " +
"Check related PR (https://github.com/JetBrains/Exposed/pull/2143) for more details.",
ReplaceWith(
"object : Table() { val c = column().transform(wrap, unwrap) }"
)
Expand All @@ -862,7 +872,9 @@ abstract class EntityClass<ID : Comparable<ID>, out T : Entity<ID>>(
"Please use the transform function from the DSL layer. " +
"Memoization will not be a part of column transformation API anymore. " +
"Please log a request on YouTrack (https://youtrack.jetbrains.com/newIssue?project=EXPOSED) " +
"if a use-case cannot be sufficiently covered by the DSL transform().",
"if a use-case cannot be sufficiently covered by the DSL transform(). " +
"With version 0.53.0 Entity transformation got several breaking changes. " +
"Check related PR (https://github.com/JetBrains/Exposed/pull/2143) for more details.",
ReplaceWith(
"object : Table() { val c = column().transform(wrap, unwrap) }"
)
Expand Down

0 comments on commit ce39d44

Please sign in to comment.