Skip to content

Commit 6e88789

Browse files
committed
Add float64 value
1 parent 888d434 commit 6e88789

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

values.go

+24
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,30 @@ func (Int64) Type() string {
108108
return "int"
109109
}
110110

111+
type Float64 float64
112+
113+
func Float64Of(f *float64) *Float64 {
114+
return (*Float64)(f)
115+
}
116+
117+
func (f *Float64) Set(s string) error {
118+
ff, err := strconv.ParseFloat(s, 64)
119+
*f = Float64(ff)
120+
return err
121+
}
122+
123+
func (f Float64) Value() float64 {
124+
return float64(f)
125+
}
126+
127+
func (f Float64) String() string {
128+
return strconv.FormatFloat(float64(f), 'f', -1, 64)
129+
}
130+
131+
func (Float64) Type() string {
132+
return "float64"
133+
}
134+
111135
type Bool bool
112136

113137
func BoolOf(b *bool) *Bool {

0 commit comments

Comments
 (0)