package service import ( "xps/datamodel" "xps/datasource" "xps/repositories" "xps/viewmodel" ) type RepoService interface { GetList(m map[string]interface{}) ([]viewmodel.RepoInfo, error) GetPage(m map[string]interface{}) (*viewmodel.PageResult, error) GetListById(repoTypeId int64) ([]viewmodel.RepoInfo, error) GetById(repoTypeId, repoId int64) (*viewmodel.RepoInfo, error) Create(d *datamodel.Repo) error Update(d *datamodel.Repo) error Delete(m map[string]interface{}) error } type repoService struct { repo *repositories.Repo } func NewRepoService() RepoService { return &repoService{ repo: repositories.NewRepo(datasource.InstanceMaster()), } } func (s *repoService) GetList(m map[string]interface{}) ([]viewmodel.RepoInfo, error) { return s.repo.GetList(m) } func (s *repoService) GetListById(repoTypeId int64) ([]viewmodel.RepoInfo, error) { return s.repo.GetListById(repoTypeId) } func (s *repoService) GetPage(m map[string]interface{}) (*viewmodel.PageResult, error) { return s.repo.GetPage(m) } func (s *repoService) GetById(repoTypeId, repoId int64) (*viewmodel.RepoInfo, error) { return s.repo.GetById(repoTypeId, repoId) } func (s *repoService) Create(m *datamodel.Repo) error { m.RepoId = NewID() return s.repo.Create(m) } func (s *repoService) Update(m *datamodel.Repo) error { return s.repo.Update(m) } func (s *repoService) Delete(m map[string]interface{}) error { return s.repo.Delete(m) }