in datastore/src/main/scala/magnolify/datastore/EntityType.scala [42:53]
implicit def apply[T: EntityField]: EntityType[T] = EntityType(CaseMapper.identity)
def apply[T](cm: CaseMapper)(implicit f: EntityField[T]): EntityType[T] = f match {
case r: EntityField.Record[_] =>
new EntityType[T] {
private val caseMapper: CaseMapper = cm
override def from(v: Entity): T = r.fromEntity(v)(caseMapper)
override def to(v: T): Entity.Builder = r.toEntity(v)(caseMapper)
}
case _ =>
throw new IllegalArgumentException(s"EntityType can only be created from Record. Got $f")
}