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

Compose operation for MappedColumnType. #8

Closed DavidGregory084 closed 10 years ago

DavidGregory084 commented 10 years ago

Closes #4

DavidGregory084 commented 10 years ago

One thing I've spotted with this since opening the PR: you can't use any composition which puts an Option[_] type on the B / "database" side of a MappedColumnType. The baseType field on MappedColumnType is defined as BaseColumnType and OptionColumnType does not extend this trait, so the context bound on compose fails to resolve. This means you can only put a MappedColumnType[Option[A], B] as the first type in a composition chain. Is this something that needs to be resolved?

brendanator commented 10 years ago

I think this will be fine. Generally when this is used only 2 MappedColumnTypes will be composed. The inner one will do something like trimming the string and the outer one would convert it into an option type