diff options
author | Stewart Stewart <stewinsalot@gmail.com> | 2016-12-19 19:55:44 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-19 19:55:44 -0500 |
commit | e7b85bb543faba7a58f1e27be40bb6536bf10222 (patch) | |
tree | 3628ddf47ce32263db6fca348b0d5bfc5b8d08bc /src/main/scala/xyz/driver/core | |
parent | 861ceb03e8faeb564dd027b13250b5604af8645f (diff) | |
parent | b66ac9deca6875f0a9757f6263d0170312be5bd8 (diff) | |
download | driver-core-e7b85bb543faba7a58f1e27be40bb6536bf10222.tar.gz driver-core-e7b85bb543faba7a58f1e27be40bb6536bf10222.tar.bz2 driver-core-e7b85bb543faba7a58f1e27be40bb6536bf10222.zip |
Merge pull request #11 from drivergroup/typesafe-id-no-eq-relation
Typesafe Id mapping via implicit conversions.
Diffstat (limited to 'src/main/scala/xyz/driver/core')
-rw-r--r-- | src/main/scala/xyz/driver/core/core.scala | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main/scala/xyz/driver/core/core.scala b/src/main/scala/xyz/driver/core/core.scala index 8ae9122..783150a 100644 --- a/src/main/scala/xyz/driver/core/core.scala +++ b/src/main/scala/xyz/driver/core/core.scala @@ -32,6 +32,10 @@ package core { object Id { implicit def idEqual[T]: Equal[Id[T]] = Equal.equal[Id[T]](_ == _) implicit def idOrdering[T]: Ordering[Id[T]] = Ordering.by[Id[T], String](_.value) + + object Mapper { + def apply[A, B]: (Id[A] => Id[B]) = (id: Id[A]) => Id[B](id.value) + } } final case class Name[+Tag](value: String) extends AnyVal { |