func (m *RoomModel) Create(room *model.Room, conn redis.Conn) error { m.syncing.Wait() //defer m.sync() if room.ID == "" { if uuid, err := uuid.NewRandom(); err != nil { return err } else { room.ID = uuid.String() } } _, err := m.save(room.ID, room, conn) return err }
func (m *ThingModel) Create(thing *model.Thing, conn redis.Conn) error { m.syncing.Wait() //defer m.sync() if thing.ID == "" { if uuid, err := uuid.NewRandom(); err != nil { return err } else { thing.ID = uuid.String() } } _, err := m.save(thing.ID, thing, conn) return err }