Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以在 Lift 中定义一个无符号映射整数?我找不到任何关于它的信息。
class Project extends LongKeyedMapper[Project] with IdPK { def getSingleton = Project ... object budget extends MappedInt(this) // should be unsigned! ... }
由于 scala 或 java 中没有无符号整数,您所能做的就是编写运行时检查。像这样的东西应该这样做:(还没有测试过)
object budget extends MappedInt(this) { override def validations = { ((value:Int) => if (value < 0) FieldError(fieldOwner, Text("Budget must not be negative"))::Nil else Nil) :: super.validations } }