https://kotlinlang.org logo
#ktor
Title
# ktor
n

Nikky

05/08/2020, 10:10 AM
is there any way to use
kotlin.serialization
for the Sessions feature? in particular how the data class is turned into some sort of string.. whni i extend
SessionStorage
to store those strings in postgres, i would like to have json or structured data instead of however it serializes fields
c

crummy

05/08/2020, 8:27 PM
here's an example of how to do it with gson... not sure about kotlin serialization https://ktor.io/servers/features/sessions/serializers.html
n

Nikky

05/08/2020, 8:57 PM
oh thats a feature i did not see.. then its quite possible.. i just need to pass along the Serializaer type and blindly cast .. which is fine since its only 1 type ever and if it fails i treat it as if it never did anything
so is there any way to shortcircuit this
T
->
String
->
ByteWriteChannel
->
Storage
? ideally i would want to just directly write and read T into a database and access its different fields and pass that to a
INSERT
via exposed
Is there any reason for me to not just write and read from database in
SessionSerializer
and do nothing in
SessionStorage
?
except i guess the invalidate function is on the storage