Skip to content

Commit

Permalink
chore: Fix docs/snippets exposed-dao project build fail (#2323)
Browse files Browse the repository at this point in the history
* chore: Fix docs/snippets exposed-dao project build fail

EntityWithBase64.kt file was causing compile errors due to unresolved objects
that did not have import statements.

* chore: Fix docs/snippets exposed-dao project build fail

- Replace experimental kotlin.io.encoding.Base64 with stable java.util.Base64
  • Loading branch information
bog-walk authored Dec 4, 2024
1 parent 27b8d98 commit f608246
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ 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 java.util.Base64

object TableWithText : IntIdTable() {
val text = varchar("text", length = 2048)
Expand All @@ -12,10 +13,10 @@ object TableWithText : IntIdTable() {
class EntityWithBase64(id: EntityID<Int>) : IntEntity(id) {
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 f608246

Please sign in to comment.