Skip to content

Commit

Permalink
add DeriveConfig instances for NonEmptyChunk
Browse files Browse the repository at this point in the history
  • Loading branch information
mberndt123 committed Sep 5, 2024
1 parent 209e0ac commit 18ba04a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package zio.config.magnolia

import magnolia._
import zio.config._
import zio.{Chunk, Config, LogLevel}
import zio.{Chunk, NonEmptyChunk, Config, LogLevel}

import java.net.URI
import java.time.{LocalDate, LocalDateTime, LocalTime, OffsetDateTime}
Expand Down Expand Up @@ -75,6 +75,9 @@ object DeriveConfig {
implicit def implicitChunkDesc[A: DeriveConfig]: DeriveConfig[Chunk[A]] =
DeriveConfig(Config.chunkOf(DeriveConfig[A].desc))

implicit def implicitNonEmptyChunkDesc[A: DeriveConfig]: DeriveConfig[NonEmptyChunk[A]] =
DeriveConfig(Config.nonEmptyChunkOf(DeriveConfig[A].desc))

implicit def implicitMapDesc[A: DeriveConfig]: DeriveConfig[Map[String, A]] =
DeriveConfig(Config.table(implicitly[DeriveConfig[A]].desc))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ object DeriveConfig {
given chunkDesc[A](using ev: DeriveConfig[A]): DeriveConfig[Chunk[A]] =
DeriveConfig.from(chunkOf(ev.desc))

given nonEmptyChunkDesc[A](using ev: DeriveConfig[A]): DeriveConfig[NonEmptyChunk[A]] =
DeriveConfig.from(nonEmptyChunkOf(ev.desc))

given mapDesc[A](using ev: DeriveConfig[A]): DeriveConfig[Map[String, A]] =
DeriveConfig.from(table(ev.desc))

Expand Down

0 comments on commit 18ba04a

Please sign in to comment.