Attributes
- Companion
- trait
- Source
- DbCodec.scala
- Graph
-
- Supertypes
- Self type
-
DbCodec.type
Members list
Value members
Concrete methods
Attributes
- Source
- DbCodec.scala
Returns a derivation builder for DbCodec so callers can attach precise field/type overrides before deriving the final codec.
Returns a derivation builder for DbCodec so callers can attach precise field/type overrides before deriving the final codec.
Attributes
- Source
- DbCodec.scala
Derives a DbCodec after applying caller-supplied derivation-builder overrides such as field-level custom codecs.
Derives a DbCodec after applying caller-supplied derivation-builder overrides such as field-level custom codecs.
Attributes
- Source
- DbCodec.scala
Attributes
- Source
- DbCodec.scala
Attributes
- Source
- DbCodec.scala
Attributes
- Source
- DbCodec.scala
Attributes
- Source
- DbCodec.scala
Givens
Givens
Attributes
- Source
- DbCodec.scala
Attributes
- Source
- DbCodec.scala
Attributes
- Source
- DbCodec.scala
Auto-derives a DbCodec[B] from DbCodec[A] and As[A, B].
This enables Scala 3 opaque types and ZIO Prelude Newtype/Subtype values to receive a DbCodec for free when their underlying type already has one:
opaque type ProductId = String
// provide As[String, ProductId] in the ProductId companion object
// DbCodec[ProductId] is then resolved automatically — no explicit given needed
This given is lower priority than any explicit given DbCodec[B] or derived because it lives in the companion object at the same level as primitive codecs but is polymorphic (two type parameters), making it less specific than any monomorphic given for a concrete type B.
Use DbCodec[A].transform for types that do not have an As instance.
Attributes
- Source
- DbCodec.scala
Derives a DbCodec[A] using the default column name mapper. Self-contained: derives Schema[A] internally, so no Schema needs to be in scope. Enables the Scala 3 derives clause: case class User(...) derives DbCodec
Derives a DbCodec[A] using the default column name mapper. Self-contained: derives Schema[A] internally, so no Schema needs to be in scope. Enables the Scala 3 derives clause: case class User(...) derives DbCodec
Attributes
- Source
- DbCodec.scala
Attributes
- Source
- DbCodec.scala
Attributes
- Source
- DbCodec.scala
Attributes
- Source
- DbCodec.scala
Attributes
- Source
- DbCodec.scala
Attributes
- Source
- DbCodec.scala
Attributes
- Source
- DbCodec.scala
Attributes
- Source
- DbCodec.scala
Attributes
- Source
- DbCodec.scala
Attributes
- Source
- DbCodec.scala
Attributes
- Source
- DbCodec.scala
Inherited givens
Auto-derives a DbCodec[A] for Scala 3 opaque types by reusing the codec of the underlying type. The opaque type companion must expose a public apply method from the underlying type to the opaque type, so decode uses the same validation/wrapping path as user code.
Auto-derives a DbCodec[A] for Scala 3 opaque types by reusing the codec of the underlying type. The opaque type companion must expose a public apply method from the underlying type to the opaque type, so decode uses the same validation/wrapping path as user code.
For encoding, either define the opaque type as a subtype of the underlying type:
opaque type ProductId <: String = String
object ProductId { def apply(value: String): ProductId = value }
or provide a public unwrap method:
opaque type ProductId = String
object ProductId {
def apply(value: String): ProductId = value
def unwrap(value: ProductId): String = value
}
This given lives in a super-trait so it has lower priority than derived (requires Schema) and dbCodecFromAs (requires As), both of which are defined in object DbCodec itself.
Attributes
- Inherited from:
- DbCodecOpaquePriority (hidden)
- Source
- DbCodec.scala