jhc-systems / sqlest

Write SQL in Scala
https://jhc-systems.github.io/sqlest/latest/api/
Apache License 2.0
30 stars 17 forks source link

Improve syntax of extractNamed #7

Closed brendanator closed 9 years ago

brendanator commented 10 years ago

Named extractors are currently defined using sequence of strings and extractors tuples:

lazy val fruitExtractor = extractNamed[Fruit](
  "name" -> FruitTable.name,
  "juiciness" -> FruitTable.juiciness
)

Change this to the following more syntax:

lazy val fruitExtractor = extract[Fruit](
  name = FruitTable.name,
  juiciness = FruitTable.juiciness
)
brendanator commented 10 years ago

This can be implemented by defining a macro that returns a function Each of the function parameters is the same as those in the apply method of the case class except lifted to be an Extractor

DavidGregory084 commented 10 years ago

I think that implementing this so that we have the syntax defined above is quite likely blocked by SI-7914. I'm going to ask a question on SO once I throw together a minimal example, but in the meantime I'd be interested in your feedback on whether DavidGregory084/sqlest@a31317a2203f75f396b14b8fa19d6bd0c1686e7a might be suitable.

DavidGregory084 commented 10 years ago

I finally remembered to ask an SO question for this...hopefully someone will suggest a workaround.