Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Commit

Permalink
Merge pull request #52 from buddy-sandidge/master
Browse files Browse the repository at this point in the history
Format floats to allow for very large/small values
  • Loading branch information
shadowspore authored Oct 3, 2022
2 parents 0058bbf + eb11637 commit c402435
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,30 @@ func TestKeys(t *testing.T) {
IfExists().toCmd(),
Expected: "FSET agent 47 XX cash 100500",
},
{
Cmd: keys.FSet("agent", "47").
Field("id", 123456789012345680).
IfExists().toCmd(),
Expected: "FSET agent 47 XX id 123456789012345680",
},
{
Cmd: keys.FSet("agent", "47").
Field("id", -123456789012345680).
IfExists().toCmd(),
Expected: "FSET agent 47 XX id -123456789012345680",
},
{
Cmd: keys.FSet("agent", "47").
Field("small", 0.00000000012345678901234568).
IfExists().toCmd(),
Expected: "FSET agent 47 XX small 0.00000000012345678901234568",
},
{
Cmd: keys.FSet("agent", "47").
Field("small", -0.00000000012345678901234568).
IfExists().toCmd(),
Expected: "FSET agent 47 XX small -0.00000000012345678901234568",
},
{
Cmd: keys.JSet("foo", "bar", "some.field", "some-value").Raw().toCmd(),
Expected: "JSET foo bar some.field some-value RAW",
Expand Down
2 changes: 1 addition & 1 deletion utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (c cmd) String() string {
}

func floatString(val float64) string {
return strconv.FormatFloat(val, 'g', 10, 64)
return strconv.FormatFloat(val, 'f', -1, 64)
}

func rawEventHandler(handler func(*GeofenceEvent)) func([]byte) error {
Expand Down

0 comments on commit c402435

Please sign in to comment.