【问题标题】:Lift Squeryl-Record select with google user id使用 google 用户 ID 提升 Squeryl-Record 选择
【发布时间】:2013-07-03 17:51:27
【问题描述】:

我想识别使用 Google OAuth 服务的用户。这将返回一个googleId,它是 2^67,因此它不适合我当前用作表中主键的长数据类型。因此,我想将 googleId 存储在 StringField 中。

但是,这不起作用,因为我无法让 Where 子句起作用: where(u.googleId.is === id)
产生错误value === is not a member of u.googleId.MyType

我是这样定义的:

val googleId = new StringField(this, "")

如何在 where 子句中使用 StringField 选择数据?

提前致谢

弗洛

【问题讨论】:

    标签: scala record lift squeryl


    【解决方案1】:

    BigDecimal 不成功吗? http://squeryl.org/schema-definition.html

    另外,我不确定语法,不应该是吗?:

    where(u.googleId == "hello there")
    

    我使用的是纯 squeryl 和纯 liftweb,所以我不确定..

    【讨论】:

    • 谢谢。我会在我在家的时候尝试一下,然后告诉它什么时候有效。
    【解决方案2】:

    我通过导入org.squeryl.PrimitiveTypeMode._ 解决了这个问题,这里描述了Squeryl Schema Definition

    然后我将 googleId 设置为 StringField 类型

    val googleId = new StringField(this,"")
    

    现在我必须在字段中添加一个.~,否则它将被解释为String 而不是TypedExpressionNode[Int]

    现在下面的语句起作用了:

    where(u.googleId.is.~ === id) select (u))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-12
      • 1970-01-01
      • 1970-01-01
      • 2012-07-02
      • 2018-06-13
      相关资源
      最近更新 更多