Output returns the previously recorded output for the job, if any. The return value is a raw JSON payload from the output that was recorded by the job, or nil if no output was recorded.
()
| 144 | // value is a raw JSON payload from the output that was recorded by the job, or |
| 145 | // nil if no output was recorded. |
| 146 | func (j *JobRow) Output() []byte { |
| 147 | type metadataWithOutput struct { |
| 148 | Output json.RawMessage `json:"output"` |
| 149 | } |
| 150 | |
| 151 | var metadata metadataWithOutput |
| 152 | if err := json.Unmarshal(j.Metadata, &metadata); err != nil { |
| 153 | return nil |
| 154 | } |
| 155 | |
| 156 | return metadata.Output |
| 157 | } |
| 158 | |
| 159 | // JobState is the state of a job. Jobs start their lifecycle as either |
| 160 | // JobStateAvailable or JobStateScheduled, and if all goes well, transition to |
no outgoing calls