stephencelis / SQLite.swift

A type-safe, Swift-language layer over SQLite3.
MIT License
9.67k stars 1.56k forks source link

Why users.insert(Expression<String?>("name") <- "NAME") is error? #943

Closed SunshineDays closed 3 years ago

SunshineDays commented 5 years ago
    let path = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
    let db = try? Connection("\(path)/db.sqlite3")
    let users = Table("users")
    let id = Expression<Int64>("id")
    let name = Expression<String?>("name")
    let email = Expression<String>("email")

    try! db?.run(users.create(ifNotExists: true, block: { (table) in
        table.column(id, primaryKey: true)
        table.column(name)
        table.column(email, unique: true)
    }))

let insert = users.insert(Expression<String?>("name") <- "NAME") "<-" is failed Operator is not a known binary operator

I hope some kind-hearted people help me solve it!Thanks!

sunxxg commented 5 years ago

Are you using ObjectMapper Or overloaded the ‘<-’ operator?

nathanfallet commented 3 years ago

Please ask on StackOverflow for this kind of questions (we are tracking bugs on GitHub)