本文整理汇总了Golang中github.com/andrewcharlton/school-dashboard/env.Env.LookupResultset方法的典型用法代码示例。如果您正苦于以下问题:Golang Env.LookupResultset方法的具体用法?Golang Env.LookupResultset怎么用?Golang Env.LookupResultset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/andrewcharlton/school-dashboard/env.Env
的用法示例。
在下文中一共展示了Env.LookupResultset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: filterLabels
// FilterLabels generates the labels for the filter page
func filterLabels(e env.Env, f database.Filter) []label {
labels := []label{}
// Lookup date and resultset names
// Lookup date and resultset names
date, _ := e.LookupDate(f.Date)
rs, _ := e.LookupResultset(f.Resultset)
nat, _ := e.LookupNatYear(f.NatYear)
labels = append(labels, label{nat, "default"})
labels = append(labels, label{date, "primary"})
labels = append(labels, label{rs, "primary"})
if f.Year != "" {
labels = append(labels, label{"Yeargroup: " + f.Year, "success"})
}
switch f.Gender {
case "1":
labels = append(labels, label{"Boys", "warning"})
case "0":
labels = append(labels, label{"Girls", "warning"})
}
switch f.PP {
case "1":
labels = append(labels, label{"Disadvantaged", "warning"})
case "0":
labels = append(labels, label{"Non-Disadvantaged", "warning"})
}
switch f.EAL {
case "1":
labels = append(labels, label{"EAL", "warning"})
case "0":
labels = append(labels, label{"Non-EAL", "warning"})
}
if len(f.SEN) >= 1 && len(f.SEN) < 4 {
labels = append(labels, label{"SEN: " + strings.Join(f.SEN, ", "), "warning"})
}
if len(f.KS2Bands) >= 1 && len(f.SEN) < 4 {
labels = append(labels, label{"KS2: " + strings.Join(f.KS2Bands, ", "), "warning"})
}
if len(f.Ethnicities) >= 1 && len(f.Ethnicities) <= len(e.Ethnicities) {
eths := []string{}
for _, eth := range f.Ethnicities {
if !e.OtherEths[eth] {
eths = append(eths, eth)
}
}
labels = append(labels, label{"Ethnicity: " + strings.Join(eths, ", "), "warning"})
}
return labels
}