(config editItemConfig)
| 470 | } |
| 471 | |
| 472 | func updateItemValues(config editItemConfig) error { |
| 473 | if err := fieldIdAndProjectIdPresence(config); err != nil { |
| 474 | return err |
| 475 | } |
| 476 | |
| 477 | var parsedDate time.Time |
| 478 | if config.opts.date != "" { |
| 479 | date, err := time.Parse("2006-01-02", config.opts.date) |
| 480 | if err != nil { |
| 481 | return err |
| 482 | } |
| 483 | parsedDate = date |
| 484 | } |
| 485 | |
| 486 | query, variables := buildUpdateItem(config, parsedDate) |
| 487 | err := config.client.Mutate("UpdateItemValues", query, variables) |
| 488 | if err != nil { |
| 489 | return err |
| 490 | } |
| 491 | |
| 492 | if config.opts.exporter != nil { |
| 493 | return config.opts.exporter.Write(config.io, &query.Update.Item) |
| 494 | } |
| 495 | |
| 496 | return printItemResults(config, &query.Update.Item) |
| 497 | } |
| 498 | |
| 499 | func fieldIdAndProjectIdPresence(config editItemConfig) error { |
| 500 | if config.opts.fieldID == "" && config.opts.projectID == "" { |
no test coverage detected