noursandid / SundeedQLite

Easiest local storage library in Swift
MIT License
17 stars 2 forks source link

Can't delete object with array of sub objects #20

Open starletsky opened 4 months ago

starletsky commented 4 months ago

Simple explanation

class Main: ... {
    var subObjects: [SubObject] = []
}

class SubObject: ... {
    var subSubObjects: [SubSubObject] = []
}

class SubSubObject: ... {
    ...
}

var obj = Main()
obj.subObjects = [SubObject(), SubObject(), SubObject(), SubObject(), SubObject()]

If i'll try to delete main object like this try? await obj.delete(deleteSubObjects: true)

In function func deleteFromDB<T: SundeedQLiter>(object: T, deleteSubObjects: Bool) async throws at line 248 and 249 it will never goes further because map.columns.values contains array of SundeedQLiter and not object of SundeedQLiter

And one more, i think it wont delete 3rd nested objects, because there are no recursive call to check values in sub objects.