2019-10-23から1日間の記事一覧

DBIO, DBIOAction, headOption, emap

そもそもscalazとかモナドとか全く理解していないのでそのお勉強はまたこんどして、 ひとまず使用例だけメモっとく val action = for { hogeOpt <- hogeDao.hoget.map(_.headOption) //*1 hoge<- hogeOpt.point[DBIO] emap (_ \/> new Exception("ほげありま…

Future[Option]#map(_.getOrElse(DBIO.failed...

def getOptionHoge: Future[Option[Hoge]] ={...} for { hoge <- getOptionHoge.map(_.getOrElse(DBIO.failed( シグネチャ /** Returns the option's value if the option is nonempty, otherwise * return the result of evaluating `default`. * * @param …