kv-orm/core

Support Deleting Many Relationships

GregBrimble opened this issue · 2 comments

Right now:

instance.relations = [instance, otherInstance]
await instanceRepo.save(instance)

instance.relations = [instance]
await instanceRepo.save(instance)

await instance.relations // [instance, otherInstance]

Some sort of array-like interface?

type oneToManyType<T> =
  | T[]
  | {
      push(value: T): void
      pop(): T
      clear(): void
    }
  | AsyncGenerator<T>

Add instanceRepo.delete(instance) method, and use that for some funky deletion stuff for these many relationship values.