Added float attribute type
This commit is contained in:
@ -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.
|
||||
|
Reference in New Issue
Block a user