Created
January 4, 2015 00:45
-
-
Save sonwh98/980e7798ccfc0f1e84ad to your computer and use it in GitHub Desktop.
implicit conversion of Scala String and Symbol to transit com.cognitect.transit.Keyword
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.cognitect.transit.Keyword | |
import com.cognitect.transit.impl.KeywordImpl | |
implicit class ClojureKeyword(val sc:StringContext) extends AnyVal{ | |
def k(args: Any*):KeywordImpl = { | |
val s = sc.raw(args.toSeq : _*) | |
new KeywordImpl(s) | |
} | |
} | |
implicit def symbol2keyword(s:Symbol):Keyword = new KeywordImpl(s.name) | |
val dbId: Keyword = k"db/id" | |
val name: Keyword = 'name | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment