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

Method Create

core/app/service/command.go:132–144  ·  view source on GitHub ↗
(req dto.CommandOperate)

Source from the content-addressed store, hash-verified

130}
131
132func (u *CommandService) Create(req dto.CommandOperate) error {
133 command, _ := commandRepo.Get(repo.WithByName(req.Name), repo.WithByType(req.Type))
134 if command.ID != 0 {
135 return buserr.New("ErrRecordExist")
136 }
137 if err := copier.Copy(&command, &req); err != nil {
138 return buserr.WithDetail("ErrStructTransform", err.Error(), nil)
139 }
140 if err := commandRepo.Create(&command); err != nil {
141 return err
142 }
143 return nil
144}
145
146func (u *CommandService) Delete(ids []uint) error {
147 if len(ids) == 1 {

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