Created
October 23, 2019 00:08
-
-
Save captaincole/a4279597c2cce94c9e267a1a54fbfd2c to your computer and use it in GitHub Desktop.
Sangria Scala Query For Order by Asset Type
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
// Example of a type safe query that returns an Order object | |
def orderByAssetType(assetType: OrderAssetType)(implicit ctx: C): Future[OrderRead] = db.run { dsl => | |
dsl.selectFrom(ORDER) | |
.where(ORDER.ASSET_TYPE equal assetType) | |
.fetchOne() | |
.make[OrderRead] // Return an Order Object | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment