https://kotlinlang.org logo
Title
p

PoisonedYouth

05/20/2023, 11:42 AM
The second part of my article related to how to start with coroutines is published: https://medium.com/towardsdev/how-to-start-with-coroutines-in-springboot-applications-part-2-b0d291ebaa79
s

Stephan Schröder

05/22/2023, 8:29 AM
I'm still reading part2 after going back to part1. The one detail I keep noticing (which has nothing to do with coroutines 😅) is that you keep not using the single-expression form of methods. Is this a deliberate choice or are you not aware of the possibility? E.g.:
override suspend fun findAll(): Flow<Post> {
    return databaseClient
        .sql("SELECT * FROM Post")
        .map(mapping)
        .flow()
}
could be wriiten as
override suspend fun findAll(): Flow<Post> = databaseClient
    .sql("SELECT * FROM Post")
    .map(mapping)
    .flow()
p

PoisonedYouth

05/22/2023, 1:54 PM
As Java-Switcher I'm still using the java function style 😄
s

Stephan Schröder

05/22/2023, 4:22 PM
I forsee in your not so distant future a time where you'll try to make every method a single expression method (for a while) 😂