Added float attribute type

This commit is contained in:
b committed 2019-04-22 22:12:12 -06:00
1 parent cd2230f625
commit 296f7c71da
4 files changed
+33 -25

No files matched your search

+12
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.