Closed bagfatnick closed 6 years ago
When I use Model.update, nil values in the variables within the model does not get updated
Mac OS 10.13.6 SwiftKueryORM v0.2.0 SwiftKueryPostgreSQL v1.1.5
` struct Grade: Codable, Model { var subject: String var score: Int? }
//create gradeA let gradeA = Grade(subject: "Physics", score: 85) var gradeAId = Int() gradeA.save{ (id: Int?, grade: Grade?, error: RequestError?) in ... gradeAId = id print(id, grade) //3 Grade(subject: "Physics", score: Optional(85)) } //update gradeA let modifiedGradeA = Grade(subject: "Chemistry", score: nil) modifiedGradeA.update(id: gradeAId) { (grade, error) in ... print(grade) //Grade(subject: "Chemistry", score: nil) } //check gradeA now Grade.find(id: gradeAId) { (grade, error) in ... print(grade) //Grade(subject: "Chemistry", score: Optional(85)) }
`
This had been merged - will be included in the next tag.
Context and Description
When I use Model.update, nil values in the variables within the model does not get updated
Environment Details
Mac OS 10.13.6 SwiftKueryORM v0.2.0 SwiftKueryPostgreSQL v1.1.5
Steps to Reproduce
` struct Grade: Codable, Model { var subject: String var score: Int? }
`
Expected vs. Actual Behaviour