Skip to content

Commit

Permalink
chore: Fix docs/snippets exposed-dao project build fail
Browse files Browse the repository at this point in the history
- Replace experimental kotlin.io.encoding.Base64 with stable java.util.Base64
  • Loading branch information
bog-walk committed Dec 4, 2024
1 parent 56cdde3 commit 805b830
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,19 @@ 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 kotlin.io.encoding.Base64
import kotlin.io.encoding.ExperimentalEncodingApi
import java.util.Base64

object TableWithText : IntIdTable() {
val text = varchar("text", length = 2048)
}

class EntityWithBase64(id: EntityID<Int>) : IntEntity(id) {
@OptIn(ExperimentalEncodingApi::class)
var base64: String by TableWithText.text
.memoizedTransform(
wrap = { Base64.encode(it.toByteArray()) },
unwrap = { Base64.decode(it).toString() }
wrap = { Base64.getEncoder().encodeToString(it.toByteArray()) },
unwrap = { Base64.getDecoder().decode(it).toString() }
)

companion object :
IntEntityClass<EntityWithUInt>(TableWithText)
IntEntityClass<EntityWithBase64>(TableWithText)
}

0 comments on commit 805b830

Please sign in to comment.