package service import ( "xps/datamodel" "xps/datasource" "xps/repositories" "xps/viewmodel" ) type RepoTypeService interface { GetList(m map[string]interface{}) ([]viewmodel.RepoTypeInfo, error) GetPage(m map[string]interface{}) (*viewmodel.PageResult, error) GetById(repoTypeId int64) (*viewmodel.RepoTypeInfo, error) Create(d *datamodel.RepoType) error Update(d *datamodel.RepoType) error Delete(m map[string]interface{}) error } type repoTypeService struct { repo *repositories.RepoTypeRepo } func NewRepoTypeService() RepoTypeService { return &repoTypeService{ repo: repositories.NewRepoTypeRepo(datasource.InstanceMaster()), } } func (s *repoTypeService) GetList(m map[string]interface{}) ([]viewmodel.RepoTypeInfo, error) { return s.repo.GetList(m) } func (s *repoTypeService) GetPage(m map[string]interface{}) (*viewmodel.PageResult, error) { return s.repo.GetPage(m) } func (s *repoTypeService) GetById(repoTypeId int64) (*viewmodel.RepoTypeInfo, error) { return s.repo.GetById(repoTypeId) } func (s *repoTypeService) Create(RepoType *datamodel.RepoType) error { RepoType.RepoTypeId = NewID() return s.repo.Create(RepoType) } func (s *repoTypeService) Update(RepoType *datamodel.RepoType) error { return s.repo.Update(RepoType) } func (s *repoTypeService) Delete(m map[string]interface{}) error { return s.repo.Delete(m) }