简体   繁体   English

玩Scala Anorm“Magic [Country]()。使用(”国家“)”

[英]Play Scala Anorm “Magic[Country]().using(”Countries“)”

In looking at the docs for Play Scala Anorm, they show specifying a alternate table name as using this syntax: 在查看Play Scala Anorm的文档时,他们会显示使用以下语法指定备用表名:

object Country extends Magic[Country]().using("Countries")

When i try to use this i get: 当我尝试使用这个时,我得到:

Error raised is : ';' expected but '.' found.

What is the correct Scala syntax for this to work? 什么是正确的Scala语法才能工作?

Well there is an error in the example. 那个例子中有一个错误。 You can do 你可以做

val Country = new Magic[Country]().using("Countries")

but you certainly cannot do that with an object declaration You can use another constructor of Magic 但你肯定不能用对象声明做到这一点你可以使用Magic的另一个构造函数

object Country extends Magic[Country](Some("Countries"))

(see object User extends Magic[User]().using("users") can not compiled ) (见对象用户扩展Magic [User]()。using(“users”)无法编译

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM