Skip to content

Instantly share code, notes, and snippets.

@bneil
Created December 31, 2015 23:34
Show Gist options
  • Save bneil/938556e24df16746f2de to your computer and use it in GitHub Desktop.
Save bneil/938556e24df16746f2de to your computer and use it in GitHub Desktop.
Adding a custom en/decoder for quill async-postgres
import java.util.UUID
import com.github.mauricio.async.db.RowData
trait CustomCodecs {
implicit val uuidEncoder = new Database.db.Encoder[UUID] {
def apply(index: Int, value: UUID, row: List[Any]) =
row :+ value
}
implicit val uuidDecoder = new Database.db.Decoder[UUID] {
def apply(index: Int, row: RowData): UUID = row(index) match {
case value: UUID => value
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment