Is thr any way to get json data from mysql like f...
# ktor
Is thr any way to get json data from mysql like for varchar we do it like this
Copy code
val meterId = varchar("meter_id")
i have a field in mysql db with json data type which is data in following way..
Copy code
"[129691049, 129691048, 129691041, 129690909, 129690240]"
in spring boot it is handled like this
Copy code
@Type(type = "json")
@Column(name = "story_set", columnDefinition = "json")
private Set<Integer> storyIdSet;
what i can't figure out is to write its ktor equivalent
got the solution need to include
Copy code
Copy code
val storyIdSet = json<List<Int>>("story_set")
then can be converted to Set<Int> like
Copy code
val storyIdSet: Set<Int> = it[UserHistoryEntity.storyIdSet]?.toSet() ?: emptySet()
Ktor is an http client/server library only. Its responsibility ends as soon as you're out of the API layer of your application. You were most likely using the
module of Spring to get database access through Hibernate. The good news is that you're free to continue using Hibernate with Ktor; it might just take some additional effort to integrate it, because you don't have the whole framework aspect of Spring to do it for you. Ktorm is an excellent solution, but it's not actually related to Ktor at all; just an unfortunate name collision. I can also suggest Exposed, which is also by JetBrains.
Thanks @Andrew O'Hara , this is very informative I am new to ktor ..will explore around these too..