All Downloads are FREE. Search and download functionalities are using the official Maven repository.

wei-k.ghscala_2.10.0.5.0.source-code.package.scala Maven / Gradle / Ivy

import argonaut.{EncodeJson, DecodeJson}
import httpz.Action
import java.text.SimpleDateFormat
import scalaz.~>

package object ghscala{

  type DateTime = org.joda.time.DateTime
  private[ghscala] type JsonToString[A <: httpz.JsonToString[A]] =
    httpz.JsonToString[A]

  type CodecJson[A] = argonaut.CodecJson[A]
  val CodecJson = argonaut.CodecJson

  implicit val datetimeCodecJson: CodecJson[DateTime] =
    CodecJson.derived(
      EncodeJson.jencode1(_.toString()),
      DecodeJson.optionDecoder({
        _.string.map{ str =>
          new DateTime((new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")).parse(str))
        }
      },"DateTime")
    )

  val interpreter: Command ~> Action = Interpreter
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy