This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def unWrapJson(json: JsonValue) = | |
| json match { | |
| case JsonString(value) => value | |
| case JsonDouble(value) => value.toString | |
| } | |
| sealed trait JsonValue | |
| case class JsonString(value: String) extends JsonValue | |
| case class JsonDouble(value: Double) extends JsonValue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| case class JsonObject(fields: HList ) extends JsonValue | |
| implicit def hlistObjectEncoder[K <: Symbol, H, T <: HList]( implicit | |
| witness: Witness.Aux[K], | |
| hEncoder: Lazy[JsonEncoder[H]], | |
| tEncoder: JsonObjectEncoder[T] | |
| ): JsonObjectEncoder[FieldType[K, H] :: T] = { | |
| val fieldName: String = witness.value.name | |
| createObjectEncoder { hlist => | |
| val head = hEncoder.value.encode(hlist.head) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| trait FieldLister[A] { | |
| val list: List[String] | |
| } | |
| trait FieldListerLowPriority { | |
| implicit def primitiveFieldLister[K <: Symbol, H, T <: HList](implicit witness: Witness.Aux[K], tLister: FieldLister[T] | |
| ): FieldLister[FieldType[K, H] :: T] = new FieldLister[FieldType[K, H] ::T] { | |
| override val list = witness.value.name :: tLister.list | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| case class State( //items: Map[Int, Map[String, Any]], | |
| items: List[HList] = List.empty[HNil], | |
| defaultValues: Option[Map[String, String]], | |
| rowActive: Int, | |
| itemNew: ItemNew, | |
| transition: (Int, Int) = (0,0) ) | |
| val reduce: Reducer[ActionsStore, State] = Reducer { | |
| case (s, Clean) => | |
| s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package encoderLabelledGeneric | |
| import typesJson._ | |
| import shapeless.{HList, ::, HNil, Lazy} | |
| import shapeless.Witness | |
| import shapeless.labelled.FieldType | |
| import shapeless.LabelledGeneric | |
| import shapeless._ | |
| import syntax.singleton._ | |
| import record._ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| trait TransformData[A] { | |
| def transform(a: A): Map[String, String] | |
| } | |
| object TransformData { | |
| implicit def genericTransform[A, ARepr <: HList](implicit gen: LabelledGeneric.Aux[A, ARepr], | |
| toMap: ops.record.ToMap[ARepr] | |
| ): TransformData[A] = | |
| new TransformData[A] { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package outwatch_components | |
| import cats._ | |
| import cats.implicits._ | |
| import monix.execution.Ack.Continue | |
| import monix.execution.{Ack, Cancelable} | |
| import monix.execution.Scheduler.Implicits.global | |
| import monix.execution.exceptions.DummyException |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package manik1.modules | |
| import boopickle.Default._ | |
| import cats.effect.SyncIO | |
| import com.raquo.domtypes.jsdom.defs.events.TypedTargetMouseEvent | |
| import org.scalajs.dom.{html, Element} | |
| import org.scalajs.dom.raw.MouseEvent | |
| import spatutorial.shared.{Articulo, Father, Partida} | |
| import outwatch_components.inputs._ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //The function to test are these: | |
| def testingTest(id: IdPedido): F[Either[String, GralDataPedido]] | |
| def testingTest( id: IdPedido ): ApiFunction[Either[String, GralDataPedido ]] = Action { state => | |
| val pedido = new CGralDataPedido( ) | |
| pedido.byId(id).unsafeToFuture( ) | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //case class GralDataPedido(no_pedido: String, compra: String, ejercicio: Int, fecha_pedido: java.sql.Date) | |
| //case class Fechas(fecha: String) | |
| implicit val dateGet: Get[Date] = Get[Fechas].tmap{ case date => | |
| val format = new SimpleDateFormat("yyyy-MM-dd") | |
| val parsed = format.parse(date.fecha) | |
| new java.sql.Date(parsed.getTime()) | |
| } | |
| implicit val datePut: Put[Date] = Put[Fechas].tcontramap{ case date => |