我想在SourceTree中设置默认文件查看器.现在的当前是记事本,它没有正确显示换行符(所有代码都在一行中).
我使用logfromimport 'dart:developer';但当我使用 from 单元测试时它似乎不会打印任何内容。
我应该使用什么来在测试和开发环境中而不是在生产环境中进行日志记录?
谢谢。
我在播放框架2.3支持postgresql 9.4中使用anorm 2.4
给这样的模型:
case class EmailQueue(id:UUID,
send_from:String,
send_to:String,
subject:String,
body:String,
created_date:Date,
is_sent:Boolean,
email_template:String)
Run Code Online (Sandbox Code Playgroud)
这是我的解析器:
val parser: RowParser[EmailQueue] = {
get[UUID]("id") ~
get[String]("send_from") ~
get[String]("send_to") ~
get[String]("subject") ~
get[String]("body") ~
get[Date]("created_date") ~
get[Boolean]("is_sent") ~
get[String]("email_template") map {
case id ~ send_from ~ send_to ~ subject ~ body ~
created_date ~ is_sent ~ email_template=> EmailQueue(id,
send_from,
send_to,
subject,
body,
created_date,
is_sent,
email_template)
}
Run Code Online (Sandbox Code Playgroud)
}
这是我的插入声明:
def insert(email:EmailQueue): Unit ={
DB.withTransaction { implicit c =>
SQL(s"""
INSERT INTO "email_queue" ( "body", "created_date", …Run Code Online (Sandbox Code Playgroud) Slick 3有"import api"来使用特定的数据库驱动程序.例如
import slick.driver.H2Driver.api._
...DAO implementation...
Run Code Online (Sandbox Code Playgroud)
要么
import slick.driver.PostgresDriver.api._
...DAO implementation...
Run Code Online (Sandbox Code Playgroud)
如何在生产中使用postgresql,在单元测试中使用h2?
我的控制器方法:
def postCategory = Action(parse.tolerantText) { request =>
Ok("")
}
Run Code Online (Sandbox Code Playgroud)
这是我的测试:
val result = categoryController.postCategory.apply(FakeRequest())
status(result) mustEqual OK //error this line
Run Code Online (Sandbox Code Playgroud)
我有这个错误:
错误:(63,14)类型不匹配;找到:play.api.libs.streams.Accumulator [akka.util.ByteString,play.api.mvc.Result]必需:scala.concurrent.Future [play.api.mvc.Result]状态(结果)mustEqual OK ^
似乎使用自定义解析器parse.*使其返回Accumulator而不是Future[Result]
我正在使用play 2.5-RC2
函数接受如下输入:
myFunction("param1" -> "value1", "param2" -> "value2")
Run Code Online (Sandbox Code Playgroud)
myFunction中的参数类型是(String,String)*.现在,我想将这些参数存储在这样的地图对象中:
val p = Map("param1" -> "value1", "param2" -> "value2")
Run Code Online (Sandbox Code Playgroud)
原因是因为我想在传递之前传递p,myFunction就像这样:myFunction([converting p to (String,String)* here])我无法更改参数类型myFunction.我怎样才能转换p成(String, String)*?
我使用akka http客户端2.4.6将json发布到服务器(服务器要求消息的内容类型为applicaton / json才能处理):
val request = HttpRequest(uri = "http://localhost:9000/auth/add-user",
method = HttpMethods.POST,
entity = ByteString(write(createUser)))
.withHeaders(headers.`Content-Type`(ContentTypes.`application/json`))
Http().singleRequest(request)
Run Code Online (Sandbox Code Playgroud)
我收到此警告:
显式设置的HTTP标头'Content-Type:application / json'被忽略,
Content-Type不允许显式标头。HttpRequest.entity.contentType改为设置 。
服务器端的错误是:
415不支持的媒体类型
如何正确设置内容类型?
我正在使用支持数组列字段的postgresql.要解析一行,我使用此解析器.它在Array对象上有错误.我想我做错了.
case class ServiceRequest(
id: Pk[Long],
firstname: String,
lastname: String,
images: Array[String])
val parser: RowParser[ServiceRequest] = {
get[Pk[Long]]("id") ~
get[String]("firstname") ~
get[String]("lastname") ~
Error here >>> get[Array[String]]("images") map {
case id ~ firstname ~ lastname ~ images=>
ServiceRequest(id, firstname, lastname, images)
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢
我有这个json:
{
"errors": {
"password": [
"This field is required"
],
"email": [
"This field is required"
]
}
}
Run Code Online (Sandbox Code Playgroud)
如何计算"错误"节点下的子节点?
scala ×7
anorm ×2
json ×2
postgresql ×2
akka-http ×1
flutter ×1
flutter-test ×1
slick ×1
unit-testing ×1