DbCodecDeriver

zio.blocks.sql.DbCodecDeriver
See theDbCodecDeriver companion object
class DbCodecDeriver(columnNameMapper: SqlNameMapper = ...) extends Deriver[DbCodec]

Attributes

Companion
object
Source
DbCodecDeriver.scala
Graph
Supertypes
trait Deriver[DbCodec]
class Object
trait Matchable
class Any
Known subtypes

Members list

Type members

Inherited types

type HasInstance[F[_, _]] = HasInstance[F, DbCodec]

Attributes

Inherited from:
Deriver
Source
Deriver.scala

Value members

Concrete methods

override def deriveDynamic[F[_, _]](binding: Dynamic, doc: Doc, modifiers: Seq[Reflect], defaultValue: Option[DynamicValue], examples: Seq[DynamicValue])(implicit F: HasBinding[F], D: HasInstance[F]): Lazy[DbCodec[DynamicValue]]

Attributes

Definition Classes
Source
DbCodecDeriver.scala
override def deriveMap[F[_, _], M[_, _], K, V](key: Reflect[F, K], value: Reflect[F, V], typeId: TypeId[M[K, V]], binding: Map[M, K, V], doc: Doc, modifiers: Seq[Reflect], defaultValue: Option[M[K, V]], examples: Seq[M[K, V]])(implicit F: HasBinding[F], D: HasInstance[F]): Lazy[DbCodec[M[K, V]]]

Attributes

Definition Classes
Source
DbCodecDeriver.scala
override def derivePrimitive[A](primitiveType: PrimitiveType[A], typeId: TypeId[A], binding: Primitive[A], doc: Doc, modifiers: Seq[Reflect], defaultValue: Option[A], examples: Seq[A]): Lazy[DbCodec[A]]

Attributes

Definition Classes
Source
DbCodecDeriver.scala
override def deriveRecord[F[_, _], A](fields: IndexedSeq[Term[F, A, _]], typeId: TypeId[A], binding: Record[A], doc: Doc, modifiers: Seq[Reflect], defaultValue: Option[A], examples: Seq[A])(implicit F: HasBinding[F], D: HasInstance[F]): Lazy[DbCodec[A]]

Attributes

Definition Classes
Source
DbCodecDeriver.scala
override def deriveSequence[F[_, _], C[_], A](element: Reflect[F, A], typeId: TypeId[C[A]], binding: Seq[C, A], doc: Doc, modifiers: Seq[Reflect], defaultValue: Option[C[A]], examples: Seq[C[A]])(implicit F: HasBinding[F], D: HasInstance[F]): Lazy[DbCodec[C[A]]]

Attributes

Definition Classes
Source
DbCodecDeriver.scala
override def deriveVariant[F[_, _], A](cases: IndexedSeq[Term[F, A, _]], typeId: TypeId[A], binding: Variant[A], doc: Doc, modifiers: Seq[Reflect], defaultValue: Option[A], examples: Seq[A])(implicit F: HasBinding[F], D: HasInstance[F]): Lazy[DbCodec[A]]

Attributes

Definition Classes
Source
DbCodecDeriver.scala
override def deriveWrapper[F[_, _], A, B](wrapped: Reflect[F, B], typeId: TypeId[A], binding: Wrapper[A, B], doc: Doc, modifiers: Seq[Reflect], defaultValue: Option[A], examples: Seq[A])(implicit F: HasBinding[F], D: HasInstance[F]): Lazy[DbCodec[A]]

Attributes

Definition Classes
Source
DbCodecDeriver.scala

Inherited methods

final def binding[F[_, _], T, A](fa: F[T, A])(implicit F: HasBinding[F]): Binding[T, A]

Attributes

Inherited from:
Deriver
Source
Deriver.scala
final def instance[F[_, _], T, A](fa: F[T, A])(implicit D: HasInstance[F]): Lazy[DbCodec[A]]

Attributes

Inherited from:
Deriver
Source
Deriver.scala

Attributes

Inherited from:
Deriver
Source
Deriver.scala

Attributes

Inherited from:
Deriver
Source
Deriver.scala
final def withInstance[A, B](typeId: TypeId[A], termName: String, instance: => DbCodec[B]): Deriver[DbCodec]

Returns a new deriver that pre-registers a field-level instance override. During derivation, the field named termName inside the parent record/variant identified by typeId will use the supplied instance instead of deriving one.

Returns a new deriver that pre-registers a field-level instance override. During derivation, the field named termName inside the parent record/variant identified by typeId will use the supplied instance instead of deriving one.

This is a medium-precision override between optic-based (exact path) and type-based (all occurrences).

Type parameters

A

the parent record or variant type that owns the field

B

the type of the field being overridden. Note that B is not statically checked against the actual field type; a mismatch will surface as a runtime error during codec use, not at derivation time.

Value parameters

instance

the custom type-class instance for the field (evaluated lazily)

termName

the name of the field (or variant case) to override. If no field with this name exists in the target type, the override is silently ignored during derivation (matching DerivationBuilder.instance behaviour).

typeId

identifier for the parent type A

Attributes

Returns

a new Deriver that wraps this deriver with the additional override

Inherited from:
Deriver
Source
Deriver.scala
final def withInstance[A](instance: => DbCodec[A])(implicit typeId: TypeId[A]): Deriver[DbCodec]

Returns a new deriver that pre-registers a type-level instance override. During derivation, every occurrence of type A will use the supplied instance instead of deriving one.

Returns a new deriver that pre-registers a type-level instance override. During derivation, every occurrence of type A will use the supplied instance instead of deriving one.

When the returned deriver is passed to DerivationBuilder, deriver-level instance overrides take precedence over builder-level instance overrides for the same target because DerivationBuilder.derive merges them as builderOverrides ++ deriver.instanceOverrides and later entries win in the resulting .toMap.

Type parameters

A

the type whose derived instance should be replaced

Value parameters

instance

the custom type-class instance (evaluated lazily)

typeId

implicit identifier for A, used to match occurrences during derivation

Attributes

Returns

a new Deriver that wraps this deriver with the additional override

Inherited from:
Deriver
Source
Deriver.scala
final def withModifier[A](typeId: TypeId[A], termName: String, modifier: Term): Deriver[DbCodec]

Returns a new deriver that pre-registers a term-level modifier override. During derivation, the field named termName inside the parent type identified by typeId will have the modifier applied.

Returns a new deriver that pre-registers a term-level modifier override. During derivation, the field named termName inside the parent type identified by typeId will have the modifier applied.

Type parameters

A

the parent record or variant type that owns the field

Value parameters

modifier

the term-level modifier to apply

termName

the name of the field (or variant case) to modify. If no field with this name exists in the target type, the override is silently ignored.

typeId

identifier for A

Attributes

Returns

a new Deriver that wraps this deriver with the additional override

Inherited from:
Deriver
Source
Deriver.scala
final def withModifier[A](typeId: TypeId[A], modifier: Reflect): Deriver[DbCodec]

Returns a new deriver that pre-registers a reflect-level modifier override. During derivation, every occurrence of the type identified by typeId will have the modifier prepended to its modifiers.

Returns a new deriver that pre-registers a reflect-level modifier override. During derivation, every occurrence of the type identified by typeId will have the modifier prepended to its modifiers.

Type parameters

A

the type to attach the modifier to

Value parameters

modifier

the reflect-level modifier to prepend

typeId

identifier for A

Attributes

Returns

a new Deriver that wraps this deriver with the additional override

Inherited from:
Deriver
Source
Deriver.scala