Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Dominik Bucher dominikbucher

🎯
Focusing
View GitHub Profile
@dominikbucher
dominikbucher / ImprValidAccessor.scala
Last active Aug 29, 2015
Improved Scala Macro for Safe Field Access in MongoDB
View ImprValidAccessor.scala
/**
* Checks if a field accessor string like "properties.validated" is valid
* within nested case classes, e.g.:
*
* case class User(val properties: UserProperties)
* case class UserProperties(val validated: Boolean)
*
* In the above example, create an accessor object by calling
*
* val acs = accessors[User]
@dominikbucher
dominikbucher / ValidAccessor.scala
Last active Aug 29, 2015
Scala Macro for Safe Field Access in MongoDB
View ValidAccessor.scala
/**
* Checks if a field accessor string like "properties.validated" is valid
* within nested case classes, e.g.:
*
* case class User(val properties: UserProperties)
* case class UserProperties(val validated: Boolean)
*
* In the above example, valid[User]("properties.validated") would yield true.
*
* This is useful for compile time checking when doing MongoDB queries
You can’t perform that action at this time.