1 /* 2 * Make.org Core API 3 * Copyright (C) 2018 Make.org 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU Affero General Public License as 7 * published by the Free Software Foundation, either version 3 of the 8 * License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Affero General Public License for more details. 14 * 15 * You should have received a copy of the GNU Affero General Public License 16 * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 * 18 */ 19 20 package org.make.core.jsoniter 21 22 import com.github.plokhotnyuk.jsoniter_scala.core._ 23 import com.sksamuel.elastic4s.{AggReader, Hit, HitReader, Indexable} 24 25 import scala.annotation.implicitNotFound 26 import scala.util.Try 27 28 package object elastic4sJsoniter { 29 30 @implicitNotFound("No codec for type ${T} found.") 31 implicit def hitReaderWithJsoniter[T](implicit codec: JsonValueCodec[T]): HitReader[T] = 32 (hit: Hit) => Try(readFromByteBuffer[T](hit.sourceAsByteBuffer)) 33 34 @implicitNotFound("No codec for type ${T} found.") 35 implicit def indexableWithJsoniter[T](implicit codec: JsonValueCodec[T]): Indexable[T] = 36 writeToString(_: T) 37 38 @implicitNotFound("No codec for type ${T} found.") 39 implicit def aggReaderWithJsoniter[T](implicit codec: JsonValueCodec[T]): AggReader[T] = 40 (json: String) => Try(readFromString[T](json)) 41 }
| Line | Stmt Id | Pos | Tree | Symbol | Tests | Code |
|---|---|---|---|---|---|---|
| 32 | 5202 | 1165 - 1210 | ApplyToImplicitArgs | com.github.plokhotnyuk.jsoniter_scala.core.readFromByteBuffer | com.github.plokhotnyuk.jsoniter_scala.core.`package`.readFromByteBuffer[T](hit.sourceAsByteBuffer, com.github.plokhotnyuk.jsoniter_scala.core.`package`.readFromByteBuffer$default$2[T])(codec) | |
| 32 | 3231 | 1161 - 1211 | Apply | scala.util.Try.apply | scala.util.Try.apply[T](com.github.plokhotnyuk.jsoniter_scala.core.`package`.readFromByteBuffer[T](hit.sourceAsByteBuffer, com.github.plokhotnyuk.jsoniter_scala.core.`package`.readFromByteBuffer$default$2[T])(codec)) | |
| 36 | 2105 | 1361 - 1380 | ApplyToImplicitArgs | com.github.plokhotnyuk.jsoniter_scala.core.writeToString | com.github.plokhotnyuk.jsoniter_scala.core.`package`.writeToString[T]((x$1: T), com.github.plokhotnyuk.jsoniter_scala.core.`package`.writeToString$default$2[Nothing])(codec) | |
| 40 | 5490 | 1552 - 1575 | ApplyToImplicitArgs | com.github.plokhotnyuk.jsoniter_scala.core.readFromString | com.github.plokhotnyuk.jsoniter_scala.core.`package`.readFromString[T](json, com.github.plokhotnyuk.jsoniter_scala.core.`package`.readFromString$default$2[T])(codec) | |
| 40 | 3374 | 1548 - 1576 | Apply | scala.util.Try.apply | scala.util.Try.apply[T](com.github.plokhotnyuk.jsoniter_scala.core.`package`.readFromString[T](json, com.github.plokhotnyuk.jsoniter_scala.core.`package`.readFromString$default$2[T])(codec)) |