diff --git a/changelog/0.6.3.md b/changelog/0.6.3.md new file mode 100644 index 00000000..2e0fef0e --- /dev/null +++ b/changelog/0.6.3.md @@ -0,0 +1,5 @@ +Including issues: +- fsanaulla/chronicler#202 long type field support + +Contributors: +- @fsanaulla \ No newline at end of file diff --git a/modules/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/InfluxImpl.scala b/modules/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/InfluxImpl.scala index 0fe685bc..9b6562dd 100644 --- a/modules/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/InfluxImpl.scala +++ b/modules/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/InfluxImpl.scala @@ -49,7 +49,7 @@ private[macros] final class InfluxImpl(val c: blackbox.Context) { private[this] val tagsTypes = Seq(getType[Option[String]], getType[String]) private[this] val fieldTypes = - Seq(getType[Boolean], getType[Int], getType[Double], getType[String], getType[Float]) + Seq(getType[Boolean], getType[Int], getType[Double], getType[String], getType[Float], getType[Long]) private[this] def illegalArgExc(name: String): c.universe.Tree = { val msg = s"Tag value can 't be empty string for tag: $name" @@ -302,7 +302,7 @@ private[macros] final class InfluxImpl(val c: blackbox.Context) { } } - final class IntField(val key: Name, val value: Tree) extends Field { + final class IntOrLongField(val key: Name, val value: Tree) extends Field { override def unquoted(head: Boolean): c.universe.Tree = { val str = if (head) @@ -341,7 +341,7 @@ private[macros] final class InfluxImpl(val c: blackbox.Context) { def isOption(tpe: c.universe.Type): Boolean = tpe.typeConstructor =:= typeOf[Option[_]].typeConstructor def isString(tpe: c.universe.Type): Boolean = tpe =:= string - def isInt(tpe: c.universe.Type): Boolean = tpe =:= int + def isIntOrLong(tpe: c.universe.Type): Boolean = tpe =:= int || tpe =:= long /** Is it valid tag type */ def isTagType(tpe: c.universe.Type): Boolean = @@ -424,8 +424,8 @@ private[macros] final class InfluxImpl(val c: blackbox.Context) { val fields: List[Field] = fieldMethods map { case m: MethodSymbol if isString(m.returnType) => new StringField(m.name, q"obj.${m.name}") - case m: MethodSymbol if isInt(m.returnType) => - new IntField(m.name, q"obj.${m.name}") + case m: MethodSymbol if isIntOrLong(m.returnType) => + new IntOrLongField(m.name, q"obj.${m.name}") case m: MethodSymbol => new OtherField(m.name, q"obj.${m.name}") } diff --git a/version.sbt b/version.sbt index a3c3a82a..a40c96ba 100644 --- a/version.sbt +++ b/version.sbt @@ -1 +1 @@ -version in ThisBuild := "0.6.2" +version in ThisBuild := "0.6.3"