Added float attribute type

This commit is contained in:
2019-04-22 22:12:12 -06:00
parent cd2230f625
commit 296f7c71da
4 changed files with 33 additions and 25 deletions

View File

@ -57,6 +57,18 @@ var attribTypes = map[string]AttribTypeInfo{
`,
Imports: []string{"strconv"},
},
"float": {
Template: `// %[1]s creates a "%[2]s" attribute
func %[1]s(value float32) hatmill.Attrib {
return hatmill.Attrib{
Key: "%[2]s",
Value: strconv.FormatFloat(float64(value), 'G', -1, 32),
}
}
`,
Imports: []string{"strconv"},
},
}
// Def represents a top-level definition and its required imports.