- 名前: 島袋拓也
- 生年月日: 1986/09/25
2020年11末〜12月初旬の退職を目処として、転職先を検討中
def readGZIPFile[A](filePath: String, proc: String => Option[A]): Either[Throwable, Seq[A]] = { | |
val gs = new GZIPInputStream(new FileInputStream(filePath)) | |
val ss = Source.fromInputStream(gs, "UTF-8") | |
try { | |
val ret = ss.getLines().flatMap(line => proc(line)).toSeq | |
Right(ret) | |
} catch { | |
case NonFatal(t) => Left(t) | |
} finally { | |
ss.close() |
import scalikejdbc._ | |
object MySQLSyntaxSupport { | |
implicit class RichInsertSQLBuilder(val self: InsertSQLBuilder) extends AnyVal { | |
def quotedNamedValues(columnsAndValues: (SQLSyntax, ParameterBinder)*): InsertSQLBuilder = { | |
val (cs, vs) = columnsAndValues.unzip | |
val quotedCs = cs.map {column => sqls"`$column`"} | |
val quotedColumnsAndValues = quotedCs zip vs |
import Dependencies._ | |
lazy val root = (project in file(".")). | |
settings( | |
inThisBuild(List( | |
organization := "com.example", | |
scalaVersion := "2.12.5", | |
version := "0.1.0-SNAPSHOT" | |
)), | |
name := "Hello", |
VUsers.N() // output "users" | |
VUsers.Name.N() // output "name" | |
VUsers.ID.N() // output "id" | |
VUsers.A("hoge").N() // output "hoge" | |
VUsers.A("hoge").Name.N() // output "hoge.name" | |
VUsers.A("hoge").ID.N() // output "hoge.id" |
dbr.Select(VUsers.Name.N()).From(VUsers.N()).Load(&m) |
package main | |
import "fmt" | |
var ( | |
VUsers Users | |
) | |
func init() { |
tsg -u username --pass=password -d database_name |
var ret []string | |
sess.Select("id").From("users").Load(&ret) |
これはテストなので、無視してください。 | |
this is test. please ignore. |