Skip to content

Commit 2ab005b

Browse files
ciriccliderman
authored andcommitted
feat: added hex format supporting
1 parent de6284d commit 2ab005b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ Displays all content of the database limited by "LIMIT".
121121
* `geohash` - Attempts to convert the data format of the `geohash` in the coordinates of the center (lat, lng)
122122
* `int64` - Attempts to display the data as an integer 64-bit number
123123
* `float64` - Attempts to display the data as a 64-bit number c with a floating point
124+
* `hex` - Converts raw data to a hexademical
124125

125126
### help
126127
> help

cliutil/cliutil.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ package cliutil
88

99
import (
1010
"encoding/binary"
11+
"encoding/hex"
1112
"fmt"
13+
"math"
14+
1215
"github.com/TomiHiltunen/geohash-golang"
1316
"gopkg.in/mgo.v2/bson"
14-
"math"
1517
)
1618

1719
// Converts data to a string
@@ -26,6 +28,8 @@ func ToString(format string, value []byte) string {
2628
case "float64":
2729
return float64ToString(value)
2830
case "raw":
31+
case "hex":
32+
return hex.EncodeToString(value)
2933
default:
3034
}
3135

0 commit comments

Comments
 (0)