MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / Create

Method Create

core/app/service/group.go:60–72  ·  view source on GitHub ↗
(req dto.GroupCreate)

Source from the content-addressed store, hash-verified

58}
59
60func (u *GroupService) Create(req dto.GroupCreate) error {
61 group, _ := groupRepo.Get(repo.WithByName(req.Name), repo.WithByType(req.Type))
62 if group.ID != 0 {
63 return buserr.New("ErrRecordExist")
64 }
65 if err := copier.Copy(&group, &req); err != nil {
66 return buserr.WithDetail("ErrStructTransform", err.Error(), nil)
67 }
68 if err := groupRepo.Create(&group); err != nil {
69 return err
70 }
71 return nil
72}
73
74func (u *GroupService) Delete(id uint) error {
75 group, _ := groupRepo.Get(repo.WithByID(id))

Callers

nothing calls this directly

Calls 5

CopyMethod · 0.80
GetMethod · 0.65
WithByTypeMethod · 0.65
CreateMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected