本文整理汇总了Golang中github.com/diffeo/go-coordinate/coordinate.WorkUnit.Data方法的典型用法代码示例。如果您正苦于以下问题:Golang WorkUnit.Data方法的具体用法?Golang WorkUnit.Data怎么用?Golang WorkUnit.Data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/diffeo/go-coordinate/coordinate.WorkUnit
的用法示例。
在下文中一共展示了WorkUnit.Data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: fillWorkUnit
func (api *restAPI) fillWorkUnit(namespace coordinate.Namespace, spec coordinate.WorkSpec, unit coordinate.WorkUnit, repr *restdata.WorkUnit) error {
err := api.fillWorkUnitShort(namespace, spec, unit.Name(), &repr.WorkUnitShort)
if err == nil {
repr.Data, err = unit.Data()
}
if err == nil {
var meta coordinate.WorkUnitMeta
meta, err = unit.Meta()
repr.Meta = &meta
}
if err == nil {
repr.Status, err = unit.Status()
}
if err == nil {
err = buildURLs(api.Router,
"namespace", namespace.Name(),
"spec", spec.Name(),
"unit", unit.Name(),
).
URL(&repr.WorkSpecURL, "workSpec").
URL(&repr.AttemptsURL, "workUnitAttempts").
Error
}
if err == nil {
var attempt coordinate.Attempt
attempt, err = unit.ActiveAttempt()
if err == nil && attempt != nil {
// This is cheating, a little, but it's probably
// the easiest way to reuse this code
var short restdata.AttemptShort
err = api.fillAttemptShort(namespace, attempt, &short)
if err == nil {
repr.ActiveAttemptURL = short.URL
}
}
}
return err
}