Skip to content

Commit

Permalink
chore: Stop using the deprecated transform()
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Viernau <[email protected]>
  • Loading branch information
fviernau committed Jul 31, 2024
1 parent 968ef7a commit aa55158
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class PackageBasedPostgresStorage(
return runCatching {
database.transaction {
ScanResultDao.find {
var expression = (ScanResults.identifier eq pkg.id.toCoordinates())
var expression = ScanResults.identifier eq pkg.id

Check warning on line 129 in scanner/src/main/kotlin/storages/PackageBasedPostgresStorage.kt

View check run for this annotation

Codecov / codecov/patch

scanner/src/main/kotlin/storages/PackageBasedPostgresStorage.kt#L129

Added line #L129 was not covered by tests

scannerMatcher?.regScannerName?.let {
expression = expression and (rawParam("scan_result->'scanner'->>'name'") tilde it)
Expand Down
8 changes: 6 additions & 2 deletions scanner/src/main/kotlin/storages/utils/ScanResultDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,22 @@ import org.jetbrains.exposed.dao.IntEntity
import org.jetbrains.exposed.dao.IntEntityClass
import org.jetbrains.exposed.dao.id.EntityID
import org.jetbrains.exposed.dao.id.IntIdTable
import org.jetbrains.exposed.sql.Column

import org.ossreviewtoolkit.model.Identifier
import org.ossreviewtoolkit.model.ScanResult

object ScanResults : IntIdTable("scan_results") {
val identifier = text("identifier").index("identifier")
val identifier: Column<Identifier> = text("identifier")
.transform({ Identifier(it) }, { it.toCoordinates() })
.index("identifier")

Check warning on line 34 in scanner/src/main/kotlin/storages/utils/ScanResultDao.kt

View check run for this annotation

Codecov / codecov/patch

scanner/src/main/kotlin/storages/utils/ScanResultDao.kt#L32-L34

Added lines #L32 - L34 were not covered by tests

val scanResult = jsonb<ScanResult>("scan_result")
}

class ScanResultDao(id: EntityID<Int>) : IntEntity(id) {
companion object : IntEntityClass<ScanResultDao>(ScanResults)

var identifier: Identifier by ScanResults.identifier.transform({ it.toCoordinates() }, { Identifier(it) })
var identifier: Identifier by ScanResults.identifier

Check warning on line 42 in scanner/src/main/kotlin/storages/utils/ScanResultDao.kt

View check run for this annotation

Codecov / codecov/patch

scanner/src/main/kotlin/storages/utils/ScanResultDao.kt#L42

Added line #L42 was not covered by tests
var scanResult: ScanResult by ScanResults.scanResult
}

0 comments on commit aa55158

Please sign in to comment.