Another question : Is there a way to do a request ...
# komapper
a
Another question : Is there a way to do a request without using a variable to store the result ? When I write
Copy code
val result = database.runQuery {
	QueryDsl.insert(Tables.user).single(User(username = request.username, password = request.password))
}
If I remove the
val result =
I get a
Type mismatch. Required: Query<Unit> Found: EntityInsertSingleQuery<User>
error, but I currently don't need to use the result
d
I use the db.runQuery(...) (not the lambda version), and I don't seem to have that problem?
Maybe you're using
fun someFunction() = db.runQuery { .. }
? If so, try
fun someFunction() { db.runQuery { .. } }
...
t
I assume that the code is probably being executed in a lambda function whose return value is Unit. Try one of the following:
Copy code
database.runQuery { ... }.run {}
or:
Copy code
database.runQuery { ... }.let {}
or:
Copy code
database.runQuery { ... }
Unit