dave08
03/24/2019, 4:56 PMcompanion object : JsonAdapter.Factory {
override fun create(type: Type, annotations: MutableSet<out Annotation>, moshi: Moshi): JsonAdapter<*>? =
PaymentResultAdapter(PaymentResult_SuccessJsonAdapter(moshi))
}
}
But then I need to implement JsonAdapter...jw
03/24/2019, 5:01 PMjw
03/24/2019, 5:01 PMdave08
03/24/2019, 5:02 PMdave08
03/24/2019, 5:06 PMjw
03/24/2019, 5:10 PMpeek()
to not consumeEllen Shapiro
03/25/2019, 1:13 PMexecuteAsList
seems to be returning things synchronously vs needing to add completion closures in this data wrapper for iOS: https://github.com/square/sqldelight/blob/master/sample/common/src/iosMain/kotlin/com/example/sqldelight/hockey/ui/PlayerData.ktjw
03/25/2019, 1:22 PMalec
03/25/2019, 1:23 PMEllen Shapiro
03/25/2019, 1:31 PMkpgalligan
03/25/2019, 1:39 PMkpgalligan
03/25/2019, 1:41 PMkpgalligan
03/25/2019, 1:41 PMkpgalligan
03/25/2019, 1:46 PMkpgalligan
03/25/2019, 1:47 PMkpgalligan
03/25/2019, 1:47 PMkpgalligan
03/25/2019, 1:49 PMdave08
03/26/2019, 2:07 PMpeek
is not really made for this...:
override suspend fun convertForReceive(context: PipelineContext<ApplicationReceiveRequest, ApplicationCall>): Any? = withContext(
<http://Dispatchers.IO|Dispatchers.IO>) {
val request = context.subject
val channel = request.value as? ByteReadChannel ?: return@withContext null
val reader = channel.toInputStream().source().buffer()
val buffer2 = reader.peek()
val type = request.type
return@withContext moshi.adapter<Any>(type.java).runCatching {
fromJson(reader)
}.onFailure {
logger.error(it) { "Error converting request body <${type.simpleName}>: ${buffer2.readUtf8()}" }
}.getOrThrow()
}
dave08
03/26/2019, 2:08 PMdave08
03/26/2019, 2:09 PMjw
03/26/2019, 3:03 PMjw
03/26/2019, 3:03 PMjw
03/26/2019, 3:03 PMjw
03/26/2019, 3:03 PMdave08
03/26/2019, 4:18 PMdave08
03/26/2019, 4:18 PMjw
03/26/2019, 4:21 PMdave08
03/26/2019, 4:24 PMdave08
03/26/2019, 4:24 PMdave08
03/26/2019, 4:25 PM