gpt4 book ai didi

scala - Anorm 查询,未找到展平

转载 作者:行者123 更新时间:2023-12-04 06:23:44 26 4
gpt4 key购买 nike

在 yabe 示例中,有以下查询:

   def allWithAuthor:List[(Post,User)] = 
SQL(
"""
select * from Post p
join User u on p.author_id = u.id
order by p.postedAt desc
"""
).as( Post ~< User ^^ flatten * )

在我的应用程序中,我有一个非常相似的查询:
def findAll:List[(Album,Artist)] = 
SQL(
"""
select * from Album al
join Artist ar on al.artist_id = ar.id
order by al.nbVotes desc
limit 100
"""
).as( Album ~< Artist ^^ flatten * )

我有这个编译错误:
The file /app/models.scala could not be compiled. Error raised is : not found: 
value flatten Error occurred in an application involving default arguments.

我没有发现与 yabe 工作示例的区别......

你为什么我有这个错误?

最佳答案

按照评论中的建议,添加

import play.db.anorm.SqlParser._

关于scala - Anorm 查询,未找到展平,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6263149/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com