aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStewart Stewart <stewinsalot@gmail.com>2016-12-18 16:33:03 -0500
committerStewart Stewart <stewinsalot@gmail.com>2016-12-18 16:35:01 -0500
commitf1c50e2cbe757926df7a94284eb0246c66394779 (patch)
tree856c99cf7552550fa52c05c6898ec2e4b5841995
parentf0b89933f97c73c14484643c14438d23e1723334 (diff)
downloaddriver-core-f1c50e2cbe757926df7a94284eb0246c66394779.tar.gz
driver-core-f1c50e2cbe757926df7a94284eb0246c66394779.tar.bz2
driver-core-f1c50e2cbe757926df7a94284eb0246c66394779.zip
add documentation for sameId
-rw-r--r--src/main/scala/xyz/driver/core/core.scala7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/scala/xyz/driver/core/core.scala b/src/main/scala/xyz/driver/core/core.scala
index ce6be34..1a6bdd7 100644
--- a/src/main/scala/xyz/driver/core/core.scala
+++ b/src/main/scala/xyz/driver/core/core.scala
@@ -25,6 +25,13 @@ package object core {
package core {
+ /**
+ * Evidence that Id[A] can be safely converted to Id[B].
+ * e.g. `implicit val CaseId = Id.sameId[Case, CasesRow]`
+ * if `CaseId` is in scope, we can use either of:
+ * `casesRowId.asId[Case]` or `caseId.asId[CasesRow]`
+ * Override convert for custom Id conversions.
+ */
@implicitNotFound("No evidence that ${A} has the same Id as ${B}")
sealed trait SameId[A, B] {
def convert(id: Id[A]): Id[B] = Id[B](id.value)