func (m *infoManager) create(info *datamodel.Info) error { if _, ok := m.info[info.ID()]; ok { return fmt.Errorf(`Sketch of type "%s" with name "%s" already exists`, info.GetType(), info.GetName()) } m.info[info.ID()] = info return nil }
// CreateDomain ... func (m *Manager) CreateDomain(info *datamodel.Info) error { infos := make(map[string]*datamodel.Info) for _, typ := range datamodel.GetTypesPb() { styp := typ tmpInfo := info.Copy() tmpInfo.Type = &styp infos[tmpInfo.ID()] = tmpInfo } return m.domains.create(info.GetName(), infos) }