Example #1
0
func (self *Member) Created(d *kol.DB) {
	g := Game{Id: self.GameId}
	if err := d.Get(&g); err != nil {
		panic(err)
	}
	d.EmitUpdate(&g)
}
Example #2
0
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)
}
Example #3
0
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)
	}
}
Example #4
0
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)
	}
}
Example #5
0
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)
			}
		}
	}
}