https://kotlinlang.org logo
#jasync-sql
Title
# jasync-sql
d

dave08

07/14/2019, 3:23 PM
The current implementation is useful for providing defaults like
it.getInt(0) ?: 0
, but maybe there could be some other name for such an implementation?
o

oshai

07/14/2019, 7:13 PM
What you said is not accurate.
getInt
will return null if the db value is null. In case the column name not exists it will throw an exception with column name (you can test it, maybe it can be more clear). for the index method it will throw ArrayIndexOutOfBound
d

dave08

07/14/2019, 8:04 PM
Oh, so if its not nullable, then one can safely just use the !! ... that's good to know! It still feels a bit funny to use it so much in Kotlin... but at least it makes more sense. It might be good to document this on those functions (I tend to look for behaviour of functions with ctrl-q alot...), but thanks for the explanation!
o

oshai

07/15/2019, 6:11 AM
The kotlin way is not to use getInt but getAs<Int>() then you dont need the null check
👍🏼 1
2 Views