how to use filter to update row in SQLite.swift library?

℡╲_俬逩灬. 提交于 2019-12-24 20:26:45

问题


I am using SQLite.swift library.

I have defined a expression:

let id = Expression<Int64>("id")

I have a variable:

let num: Int = 1

Then, in update statement I do filtering:

let users = Table("User")
// compiler error: // Binary operator '==' cannot be applied to operands of type 'Expression<Int64>' and 'Int'
users.filter(id == num) 

I get compiler error showing in above comment. I understand what the error is saying, but how to get rid of it? According to SQLite.swift library document, the library should be smart enough to map Int with Expression Int64.


回答1:


You will get rid of this error by using the Int64 type (or Int) for both the id expression and the num variable.



来源:https://stackoverflow.com/questions/47308938/how-to-use-filter-to-update-row-in-sqlite-swift-library

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!