Created
December 31, 2015 23:34
-
-
Save bneil/938556e24df16746f2de to your computer and use it in GitHub Desktop.
Adding a custom en/decoder for quill async-postgres
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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