sangria.execution.deferred.HasId.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sangria-core_2.13 Show documentation
Show all versions of sangria-core_2.13 Show documentation
Scala GraphQL implementation
The newest version!
package sangria.execution.deferred
import scala.annotation.implicitNotFound
@implicitNotFound(
msg =
"Can't find suitable `HasId` type-class instance for type `${T}`. If you have defined it already, please consider defining an implicit instance `HasId[${T}]`.")
trait HasId[T, Id] {
def id(value: T): Id
}
object HasId {
private class SimpleHasId[T, Id](fn: T => Id) extends HasId[T, Id] {
def id(value: T) = fn(value)
}
def apply[T, Id](fn: T => Id): HasId[T, Id] = new SimpleHasId[T, Id](fn)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy