设为首页 加入收藏

TOP

FunDA(2)- Streaming Data Operation:流式数据操作(四)
2017-10-10 12:10:44 】 浏览:5919
Tags:FunDA Streaming Data Operation 流式 数据 操作
, bsts: Int)
91 def toABRow(raw: (Int,Int,Int,Int)) = ABRow(raw._1,raw._3,raw._4) 92 93 import com.bayakala.funda.rowtypes.DataRowType.FDADataRow 94 95 val loader = FDADataRow(slick.driver.H2Driver, toABRow _) 96 loader.getTypedRows(selectAB.result)(db).foreach {dataRow => 97 println(s"ID:${dataRow.id} Status A = ${dataRow.asts}, B = ${dataRow.bsts}") 98 } 99 100 import com.bayakala.funda.rowtypes.ActionType.FDAAction 101 def updateAStatus(row: ABRow): FDAAction[Int] = { 102 tableA.filter{r => r.id === row.id} 103 .map(_.status) 104 .update(row.bsts) 105 } 106 107 108 loader.getTypedRows(selectAB.result)(db).map(updateAStatus(_)).foreach { 109 actionRow => 110 println(s"${actionRow.toString}") 111 } 112 113 def execAction(act: FDAAction[Int]) = db.run(act) 114 115 loader.getTypedRows(selectAB.result)(db) 116 .map(updateAStatus(_)) 117 .map(execAction(_)) 118 119 loader.getTypedRows(selectAB.result)(db).foreach {dataRow => 120 println(s"ID:${dataRow.id} Status A = ${dataRow.asts}, B = ${dataRow.bsts}") 121 } 122 123 }

 

 

 

 

 

 

 

 

 

 

 

 

 

首页 上一页 1 2 3 4 下一页 尾页 4/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇FunDA(1)- Query Result Row:.. 下一篇scala练习题1 基础知识

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目