Skip to content

Instantly share code, notes, and snippets.

@manishkkatoch
Last active January 1, 2019 16:54
Show Gist options
  • Save manishkkatoch/6d17e5b8fba602b80288619323b3dca1 to your computer and use it in GitHub Desktop.
Save manishkkatoch/6d17e5b8fba602b80288619323b3dca1 to your computer and use it in GitHub Desktop.
PropertyExists trait
@implicitNotFound(msg = "${PName} not found in ${T}")
trait PropertyExists[T, PName, PType]
object PropertyExists {
def apply[T, PType](column: Witness)(
implicit exists: PropertyExists[T, column.T, PType]): PropertyExists[T, column.T, PType] =
exists
implicit def implicitProvider[T, H <: HList, PName, PType](
implicit
gen: LabelledGeneric.Aux[T, H],
selector: Selector.Aux[H, PName, PType]
): PropertyExists[T, PName, PType] = new PropertyExists[T, PName, PType] {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment