本文整理匯總了Golang中github.com/telemetryapp/gotelemetry.Flow.ValueData方法的典型用法代碼示例。如果您正苦於以下問題:Golang Flow.ValueData方法的具體用法?Golang Flow.ValueData怎麽用?Golang Flow.ValueData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/telemetryapp/gotelemetry.Flow
的用法示例。
在下文中一共展示了Flow.ValueData方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: FetchSumOfGraphIntoFlow
func (c *CrittercismAPIClient) FetchSumOfGraphIntoFlow(path, name string, interval int, f *gotelemetry.Flow) error {
if data, found := f.ValueData(); found == true {
value, err := c.FetchSumOfGraph(path, name, interval)
if err != nil {
return err
}
data.Value = value
return nil
}
return gotelemetry.NewError(400, "Cannot extract value data from flow"+f.Tag)
}
示例2: AppStoreRatings
func (p *CrittercismPlugin) AppStoreRatings(job *job.Job, f *gotelemetry.Flow) {
jq, err := p.api.Request("GET", "apps?attributes=appType,rating", nil)
if err != nil {
job.ReportError(err)
return
}
source, err := jq.Object()
if err != nil {
job.ReportError(err)
return
}
data, found := f.ValueData()
if !found {
job.ReportError(gotelemetry.NewError(400, "Cannot extract value data from flow"+f.Tag))
return
}
if appObj, ok := source[p.appId]; ok {
app := appObj.(map[string]interface{})
data.Value = app["rating"].(float64)
switch p.ratingKey {
case "ios":
data.Icon = "fa-apple"
case "android":
data.Icon = "fa-android"
case "wp":
data.Icon = "fa-windows"
case "html5":
data.Icon = "fa-html5"
}
}
job.PostFlowUpdate(f)
job.Logf("Updated flow %s", f.Tag)
}