Jorge Castillo
07/06/2021, 1:19 PMRETURNING
working for an INSERT
query using postgresql, and seems that only using this WITH
style it is possible. Still I'm getting errors:
CREATE TABLE IF NOT EXISTS userEntity (
user_id SERIAL PRIMARY KEY,
slack_user_id VARCHAR NOT NULL,
slack_channel_id VARCHAR
);
insert:
WITH inserted_ids AS (
INSERT INTO userEntity(slack_user_id, slack_channel_id)
VALUES (:userId, :channelId)
RETURNING user_id AS insert_id
) SELECT insert_id FROM inserted_ids;
Pasting the stacktrace on the thread to avoid bloating the chatrook
07/07/2021, 3:32 PMColton Idle
07/09/2021, 4:03 PMwhen (request.path) {
"/api/one/two" ->
return "blah"
"/api/three/four?arg=myArg" ->
return "boop"
I want the second case to basically catch all api/three/four*
instead of hard coding the arg. Or maybe there's another way I should go about this. e.g. Only get the path without the args, and then if I need the args I can drill down and get them from the request if need be? Thoughts?jw
07/14/2021, 12:44 PMeygraber
07/15/2021, 4:03 AMinterface StringId {
val raw: String
}
@JvmInline
value class MyId(override val raw: String) : StringId
is it safe to pass it to a Retrofit function?
interface MyApiEndpoints {
@GET("/fetch/{id}")
suspend fun fetch(@Path("id") id: MyId): Response<JsonObject>
}
https://stackoverflow.com/questions/68232128/is-it-safe-to-pass-a-kotlin-inline-class-to-a-retrofit-functionTrevor Stone
08/03/2021, 4:37 PMMiSikora
08/03/2021, 6:39 PMMichael Friend
08/09/2021, 7:29 PMverifySqlDelightMigration
task in the 1.5.0 release? After updating from 1.4.4 the task goes from passing to failing on a migration that reorders columns by renaming to a temp table, copying the rows, then dropping the temp table. The migration works fine when running on device but when running the verify task on 1.5.0+ I get the error
Execution failed for task ':shared:verifyCommonMainDatabaseMigration'.
> A failure occurred while executing com.squareup.sqldelight.gradle.VerifyMigrationTask$VerifyMigrationAction
> Could not retrieve foreign keys for table TableA: Table not found: 'TempTableB'
Here’s a small repo that recreates the issue https://github.com/mrf7/sqldelight-migration-verifyEmiliano Schiavone
08/09/2021, 10:57 PMprivate val contentType = "application/json".toMediaType()
private val json = Json {
prettyPrint = true
ignoreUnknownKeys = true
}
..
..addConverterFactory(json.asConverterFactory(contentType))
But i cannot see the logs on logcat screen. Any idea how to display it?dimsuz
08/10/2021, 4:40 PMwire
+ grpc client
. On android client which uses okhttp as transport, blocking calls work 👌 , but our test streaming call "hangs" and then exits using socket timeout. We can see that server receives the request but then breakpoint which we have set in server code inside a generated grpc method doesn't even hit, so it hangs somewhere inside grpc stuff on server (presumably).
Swift client, generated using some Apple library, connects and successfully works with the same streaming call. Any idea on how to debug where to look at would be appreciated.Trevor Stone
08/10/2021, 6:02 PM@Test
fun passesOnJavaFailsOnNative() = runBlocking {
val failingFlow = MutableStateFlow(null).stateIn(GlobalScope, SharingStarted.Eagerly, "")
failingFlow.test { assertNull(expectItem()) }
}
@Test
fun passesOnNativeFailsOnJava() = runBlocking {
val failingFlow = MutableStateFlow(null).stateIn(GlobalScope, SharingStarted.Eagerly, "")
failingFlow.test { assertEquals("", expectItem()) }
}
dimsuz
08/11/2021, 5:47 PMwire
+ grpc
question. If I have a service like this
rpc getItemsStream(ItemRequest) returns (stream ItemResponse) {}
How do I send the initial request? Wire generates the implementation of GrpcStreamingCall which has 2 channels.
Do I understand correctly that I must send initial request using a sendChannel
?
My issue posted above seems to be caused by no request body being sent. Sending it to the channel doesn't help, maybe I must do it otherwise?
Stub implementation generated by grpc-kotlin
library has this explicitly: fun getItemsStream(request: ItemsRequest): Flow<Response>
, but wire
generates function with no params in this case.Rob Smith
08/12/2021, 2:57 AMwire
?jw
08/12/2021, 1:45 PMWilliam Reed
08/13/2021, 1:21 PMprivate long camera_id = 0;
when the field is absent in the JSON I get a
com.squareup.moshi.JsonDataException: Expected a long but was NULL at path $.camera_id
Do I need to make my own type adapter to handle this case? Trying to migrate my teams project from GSONaravind
08/18/2021, 10:05 AMAndroidSqliteDriver
in androidMain instead of application module. It works fine until i enable progaurd and throws `java.lang.NoClassDefFoundError: Failed resolution of: Lcom/squareup/sqldelight/android/AndroidSqliteDriver`;. And also i could notice that mapping.tx file has no entry of this class. Can someone be able to help on this?dimsuz
08/19/2021, 10:17 AMTimber
to 5.0.1
and get this error:
No matching variant of com.jakewharton.timber:timber:5.0.1 was found. The consumer was configured to find an API of a library compatible with Java 11, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but:
- Variant 'releaseApiPublication' capability com.jakewharton.timber:timber:5.0.1 declares an API of a library, and its dependencies declared externally:
- Incompatible because this component declares a component, with the library elements 'aar' and the consumer needed a component, preferably in the form of class files
Indeed, it's being declared as a dependency in a kotlin-plugin module (no android), but the thing is that timber 4.x
was aar
too. I'm curious what has changed?spierce7
08/19/2021, 8:40 PMjw
08/23/2021, 3:36 AMephemient
08/23/2021, 3:49 AMjean
08/24/2021, 7:16 AMsealed class SideEffect {
data class Effect1(val someValue: String) : SideEffect()
Effect2 : SideEffect()
}
val mutableSharedFlow = MutableSharedFlow<SideEffect>(replay = 0)
flowOfSideEffects.test {
mutableSharedFlow.emit(Effect1("test")
assertTrue((awaitEvent() as Event.Item).value is CustomerScreenSideEffect.NavigateToCustomerDetails)
}
Now awaitEvent()
returns a value of type Event<SideEffect>
rather than just a SideEffect
like expectItem
did, if I remember correctly. So my question is, is there a better way to down cast the value returned awaitEvent
?Rob Smith
08/26/2021, 8:08 PMwire
and an rpc call that returns google.protobuf.Empty
service AService {
rpc Working(AParam) returns (AReturn)
rpc Fails(AParam) returns (google.protobuf.Empty)
}
dimsuz
08/27/2021, 1:22 PMsort
). Is that true, despite the fact that sqlite is on disk (so IO)? But there's that mmap
and memory cache magic, so IO may not be as tough as it seems.
I can't recall the article I've read.Colton Idle
08/29/2021, 6:19 AMpath == "/api/myendpoint" -> {
return MockResponse()
.setResponseCode(200)
.setBody(
"""
{"status":0,"message":"SUCCESS"}
""".trimIndent())
}
I now want to take this json, place it into resources/json/myendpoint.json
and read it from the file instead of having large json snippets in my kotlin code.
As an end result I'd love to be able to do this but I'm a bit in over my head in terms of grabbing a resource and converting it to a string. There seems to be like 1000 different ways to do this via SO and from what I would expect... maybe there's an easy way to do this with okhttp/mockwebserver/okio that I'm missing?
path == "/api/myendpoint" -> {
return MockResponse()
.setResponseCode(200)
.setBody(javaClass.classLoader.getResourceAsStream("json/myendpoint.json").toString())
}
nitrog42
08/30/2021, 8:17 AMimport androidx.compose.ui.graphics.Colors
public val white: Color = Color(0xFFFFFFFF)
public val black: Color = Color(0xFF000000)
Is there anyway to prevent this ? (or better, control the newlines, to make section ?)
I'm using
addProperty(
PropertySpec.builder("white", ClassName("androidx.compose.ui.graphics", "Color"))
.initializer("Color(0xFFFFFFFF)")
.build()
)
myanmarking
08/31/2021, 2:30 PMeygraber
08/31/2021, 9:32 PMColton Idle
09/01/2021, 11:08 PM<h1>Charles Error Report</h1>
<h2>Failed to connect to remote host</h2>
Is there some kind of configuration I can set on mockHttpServer so I can have it set to localhost but also use charles?jw
09/02/2021, 11:01 AMjw
09/02/2021, 11:01 AMms
09/02/2021, 12:44 PMZach Klippenstein (he/him) [MOD]
09/02/2021, 1:11 PMasFlow
extension function on suspend function references, or you can do something like flow { service.call() }
Paul Woitaschek
09/06/2021, 8:58 PM