在光滑中使用circe来获取json中的数据时,我可以获取(Timestamp/DateTime)实体中没有日期字段的数据.但是当我Timestamp在实体中使用字段时,会抛出错误:
[error] /var/www/html/scala-api/src/main/scala/oc/api/http/routes/TestApi.scala:40: could not find implicit value for parameter encoder: io.circe.Encoder[Seq[oc.api.models.UserEntity]]
[error] auth => complete(userDao.getAll().map(_.asJson))
Run Code Online (Sandbox Code Playgroud)
这是代码,我用于Slick Entities并使用CIRCE进行json编码.
BaseTable:
abstract class BaseTable[T](tag: Tag, name: String) extends Table[T](tag, name) {
def id = column[Long]("id", O.PrimaryKey, O.AutoInc)
def createdAt = column[Timestamp]("created_at")
def updatedAt = column[Timestamp]("updated_at")
def deletedAt = column[Timestamp]("deleted_at")
}
Run Code Online (Sandbox Code Playgroud)
BaseEntity:
trait BaseEntity {
val id : Long
def isValid : Boolean = true
}
Run Code Online (Sandbox Code Playgroud)
UserEntity:createdAt生成编码器错误
case class UserEntity(id: Long, email: String, password: String, createdAt: Timestamp) extends BaseEntity …Run Code Online (Sandbox Code Playgroud) 我尝试GuzzleHttp在本地使用并向本地 URL 发出请求,但收到了Operation timed out. 使用的代码片段:
$url = 'https://boot-vue.test'; //local domain, tried with other urls as well
$client = new \GuzzleHttp\Client([
'verify' => false,
'timeout' => 5, // Response timeout
'connect_timeout' => 5, // Connection timeout
'peer' => false
]);
$response = $client->request($method, $url, [
'json' => $data,
'headers' => $headers,
]);
Run Code Online (Sandbox Code Playgroud)
上面的代码段适用于任何公共网站。
任何帮助都是可观的!
当我这样做时sbt docker:publishLocal,它会创建一个 Dockerfile 自动擦除文件的先前内容。
我想添加自定义命令以将 cassandra 添加到容器中。我复制粘贴了这个文件的内容
并尝试再次运行上面的命令。但这会清除所有现有内容并将其替换为默认内容。
如何在 Dockerfile 或 build.sbt 中添加 docker 命令?