Closed diuming closed 5 years ago
I will recreate the issue and do some investigation.
@diuming, The reason you get the error running query1 is that the rows returned by it do not contain the fields necessary for decoding into your User
model (they only return the email field).
A query defined as
let query3 = Select(fields: [idColumn, nameColumn, passwordColumn, emailColumn], from: [table])
is successful as all the columns are returned.
Let me know if you have any further questions.
@kilnerm thanks for replying
the query3 looks like the query2, right? SELECT * FROM Users WHERE email == "abc@cde.def";
I just want to select specific columns
, example
SELECT email FROM Users WHERE email == "abc@cde.def"
So, as you means I can only use query2 and query3 for Model, Right?
@diuming, the executeQuery API will return you an array of decoded models. Because your query1 does not include all the fields to allow the results to be decoded you see the error.
Your queries will need to retrieve all fields to be able to decode into Models. If you want to get a subset of data back from your tables you could use a connection to execute basic SwiftKuery operations.
@kilnerm Got it! thx
Swift-Kuery-ORM: 0.4.1 PostgreSQL: 10.6
Please! take a look
getUsers(email: String) function
in User Model. getUsers(query: query1) occurs an errorUser Model
extension Table