(ctx context.Context, id string, name *string, resume *string)
| 237 | |
| 238 | } |
| 239 | func (s *imlClusterService) UpdateInfo(ctx context.Context, id string, name *string, resume *string) (c *Cluster, errOut error) { |
| 240 | operator := utils.UserId(ctx) |
| 241 | if name == nil && resume == nil { |
| 242 | return nil, errors.New("no update") |
| 243 | } |
| 244 | errOut = s.store.Transaction(ctx, func(ctx context.Context) error { |
| 245 | v, err := s.store.FirstQuery(ctx, "`uuid` = ?", []interface{}{id}, "id desc") |
| 246 | if err != nil { |
| 247 | return err |
| 248 | } |
| 249 | if name != nil { |
| 250 | v.Name = *name |
| 251 | } |
| 252 | if resume != nil { |
| 253 | v.Resume = *resume |
| 254 | } |
| 255 | v.Updater = operator |
| 256 | v.UpdateAt = time.Now() |
| 257 | upCount, err := s.store.Update(ctx, v) |
| 258 | if err != nil { |
| 259 | return err |
| 260 | } |
| 261 | if upCount == 0 { |
| 262 | return errors.New("no update") |
| 263 | } |
| 264 | c = FromEntity(v) |
| 265 | return nil |
| 266 | }) |
| 267 | |
| 268 | return |
| 269 | |
| 270 | } |
| 271 | |
| 272 | func (s *imlClusterService) UpdateAddress(ctx context.Context, id string, address string) ([]*Node, error) { |
| 273 |
nothing calls this directly
no test coverage detected