Thread
#exposed
    z

    ziad

    4 years ago
    Thanks for the advice, Andrey. I did it with a slight modification (because insertAndGetId was an unresolved reference)
    val userId = Users.select {
                    Users.deviceId eq requestDeviceId
                }.map { it[Users.id] }.singleOrNull() ?: Users.insert {
                    it[deviceId] = requestDeviceId
                } get Users.id
    tapac

    tapac

    4 years ago
    Sure, any PRs to documentation are very welcome. InsertAndGetId is available in newer versions of Exposed.