why are you not using nullable types?
# announcements
j
why are you not using nullable types?
s
Because some fields can be nullable, but not present. This is used for db reads/writes, and what i do is just push the DAO and it knows which fields to populate the query with
r
then your code should probably look like:
Copy code
data class SquadEntry(
    val name: String,
    var leader: UUID? = null,
    .....
    var members: Set<UUID>? = null
)
Then if your fields aren’t present, they default to null and are already wrapped, instead of needing the
OptionalPresence
wrapper.
s
And what if leader can be null @rook?
as in, present with the value of null
r
It seems counterproductive to track a custom null state of something. What’s the limitation of treating it simply as null?
👍 1
v
his null means filling the db entry with null, empty means leave as it was before (or it is the opposite), only changing fields that were set