Skip to content

Commit

Permalink
docs: EXPOSED-626 Fix nullTransform example code (#2292)
Browse files Browse the repository at this point in the history
* nullTransform example code fix
  • Loading branch information
kdhyo authored Nov 4, 2024
1 parent 64bcd69 commit 3725287
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion documentation-website/Writerside/topics/Data-Types.topic
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,7 @@
<code-block lang="kotlin">
class MealTimeNullTransformer : ColumnTransformer&lt;LocalTime, Meal?&gt; {
override fun wrap(value: LocalTime): Meal? = when {
value.hour == 0 &amp;&amp; value.minute == 0 -&gt; null
value.hour &lt; 10 -&gt; Meal.BREAKFAST
value.hour &lt; 15 -&gt; Meal.LUNCH
else -&gt; Meal.DINNER
Expand All @@ -928,7 +929,7 @@
}

object Meals : Table() {
val mealTime: Column&lt;Meal?&gt; = time(&quot;meal_time&quot;).transform(MealTimeNullTransformer())
val mealTime: Column&lt;Meal?&gt; = time(&quot;meal_time&quot;).nullTransform(MealTimeNullTransformer())
}
</code-block>
</chapter>
Expand Down

0 comments on commit 3725287

Please sign in to comment.