wildbee/wildbee — pull request #14 by FranciscoCanas (2013-11-23 17:36:35+00:00)
Title: Queriable Trait

This is the first version of the Queriable trait that I wanted to show you guys.
Models can inherit the Queriable trait and its various helpers:
- Generalized CRUD methods: findAll, findById, findByName, insert, delete, update, etc.
- Useful Helpers: mapIdToName, idToName, nameToId, etc.

The idea is that by having all of our entities inherit this trait, we don't need to duplicate a lot of the code for interacting with the database. Instead, the queriable trait handles all of it in a generalized fashion. Two exceptions:
For inserts and updates, the model needs to implement its own mapping method that goes from a New type case class (like NewPackage) to the full case class for that table type (Package, for example). If we figure out how to generalize partial projections in the future, we can change that.