getColumnValue extracts the value for a specific column from a task
(task *model.Task, column string)
| 397 | |
| 398 | // getColumnValue extracts the value for a specific column from a task |
| 399 | func getColumnValue(task *model.Task, column string) string { |
| 400 | scalar := getScalarColumnValue(task, column) |
| 401 | if scalar != "" { |
| 402 | return scalar |
| 403 | } |
| 404 | switch column { |
| 405 | case "created", "created_at": |
| 406 | if task.Created.IsZero() { |
| 407 | return "" |
| 408 | } |
| 409 | return task.Created.Format("2006-01-02") |
| 410 | case "deps": |
| 411 | return strings.Join(task.Dependencies, ",") |
| 412 | case "tags": |
| 413 | return strings.Join(task.Tags, ",") |
| 414 | default: |
| 415 | return "" |
| 416 | } |
| 417 | } |
| 418 | |
| 419 | // getScalarColumnValue returns simple string field values. |
| 420 | func getScalarColumnValue(task *model.Task, column string) string { |