minor cleanup

This commit is contained in:
Pat Garrity 2026-01-31 21:21:13 -06:00
parent f10f79ed95
commit 53a0114cbb
Signed by: pfm
GPG key ID: 5CA5D21BAB7F3A76
2 changed files with 6 additions and 1 deletions

View file

@ -43,7 +43,7 @@ class DoobieTagDbTests extends munit.FunSuite:
private val clock = Clock.systemDefaultZone() private val clock = Clock.systemDefaultZone()
iotest("should create, read, and delete a tag") { iotest("should create, read, and delete a tag") {
val tagValue = TagValue.validate("x").get val tagValue = TagValue.unsafe("x")
val createdAt = CreatedAt.now(clock) val createdAt = CreatedAt.now(clock)
transactor.use { xa => transactor.use { xa =>
(for (for

View file

@ -20,6 +20,11 @@ object TagValue:
def validate(candidate: String): Option[TagValue] = def validate(candidate: String): Option[TagValue] =
if candidate.isEmpty() then None else Some(candidate) if candidate.isEmpty() then None else Some(candidate)
def unsafe(candidate: String): TagValue =
if candidate.isEmpty() then
throw new IllegalArgumentException("Tag values must be non-empty.")
else candidate
given CanEqual[TagValue, TagValue] = CanEqual.derived given CanEqual[TagValue, TagValue] = CanEqual.derived
given Eq[TagValue] = ( given Eq[TagValue] = (