(config editItemConfig)
| 313 | } |
| 314 | |
| 315 | func updateItemValues(config editItemConfig) error { |
| 316 | if err := fieldIdAndProjectIdPresence(config); err != nil { |
| 317 | return err |
| 318 | } |
| 319 | |
| 320 | var parsedDate time.Time |
| 321 | if config.opts.date != "" { |
| 322 | date, err := time.Parse("2006-01-02", config.opts.date) |
| 323 | if err != nil { |
| 324 | return err |
| 325 | } |
| 326 | parsedDate = date |
| 327 | } |
| 328 | |
| 329 | query, variables := buildUpdateItem(config, parsedDate) |
| 330 | err := config.client.Mutate("UpdateItemValues", query, variables) |
| 331 | if err != nil { |
| 332 | return err |
| 333 | } |
| 334 | |
| 335 | if config.opts.exporter != nil { |
| 336 | return config.opts.exporter.Write(config.io, &query.Update.Item) |
| 337 | } |
| 338 | |
| 339 | return printItemResults(config, &query.Update.Item) |
| 340 | } |
| 341 | |
| 342 | func fieldIdAndProjectIdPresence(config editItemConfig) error { |
| 343 | if config.opts.fieldID == "" && config.opts.projectID == "" { |
no test coverage detected