func (self *Member) Created(d *kol.DB) { g := Game{Id: self.GameId} if err := d.Get(&g); err != nil { panic(err) } d.EmitUpdate(&g) }
func (self *Message) Updated(d *kol.DB, old *Message) { g := Game{Id: self.GameId} if err := d.Get(&g); err != nil { panic(err) } d.EmitUpdate(&g) }
func (self *Member) Deleted(d *kol.DB) { g := Game{Id: self.GameId} if err := d.Get(&g); err == nil { d.EmitUpdate(&g) } else if err != kol.NotFound { panic(err) } }
func (self *Member) Updated(d *kol.DB, old *Member) { if old != self { g := Game{Id: self.GameId} if err := d.Get(&g); err != nil { panic(err) } d.EmitUpdate(&g) } }
func (self *Game) Updated(d *kol.DB, old *Game) { if old != self { members, err := self.Members(d) if err == nil { for _, member := range members { d.EmitUpdate(&member) } } } }