zio.schema

package zio.schema

Members list

Type members

Classlikes

object Derive

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Derive.type
object DeriveSchema

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
trait Deriver[F[_]] extends VersionSpecificDeriver[F]

Deriver builds type class instances based on a Schema.

Deriver builds type class instances based on a Schema.

The minimum set of methods to implement are:

  • deriveRecord
  • deriveEnum
  • derivePrimitive
  • deriveOption
  • deriveSequence
  • deriveMap
  • deriveTransformedRecord (for records with more than 22 fields)

In addition to this more methods can be overridden to handle all the supported Schema types of zio-schema:

  • deriveEither (calls deriveEnum by default)
  • deriveSet (calls deriveSequence by default)
  • deriveTupleN (calls deriveRecord by default)

The cached method converts this deriver to one that uses a cache of instances shared between macro invocations.

Each derive methods get an optional summoned implicit value of the derived type class. It is the deriver's decision whether to use the available instance (as a user defined customization for a given type) or not.

If the decision is to always accept a summoned value if there is any, use the Deriver.AutoAcceptSummoned trait which implements this automatically and only calls the trait's methods in case there is no available implicit for the actual type.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Self type
Deriver[F]
object Deriver

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Deriver.type
trait Factory[A]

Useful to create factory methods.

Useful to create factory methods.

import Factory._ def createSomeTrait[A: Factory](deriver: Deriver[SomeTrait])(implicit schema: Schema[A]): SomeTrait[A] = implicitly[Factory[A]].deriveSomeTrait

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object Factory

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Factory.type
class ReflectionUtils[Q <: Quotes & Singleton](val q: Q)

Attributes

Supertypes
class Object
trait Matchable
class Any

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait Deriver[F]
Self type
Deriver[F]

Extensions

Extensions

extension (s: Schema.type)
transparent inline def derived[A]: Schema[A]