json convenience method
This commit is contained in:
parent
419e7c88a3
commit
be64130ae1
1 changed files with 9 additions and 0 deletions
|
@ -56,6 +56,15 @@ func (s SDBlob) HashHex() string {
|
||||||
return hex.EncodeToString(s.Hash())
|
return hex.EncodeToString(s.Hash())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ToJson returns the SD blob hash as JSON
|
||||||
|
func (s SDBlob) ToJson() string {
|
||||||
|
j, err := json.MarshalIndent(s, "", " ")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return string(j)
|
||||||
|
}
|
||||||
|
|
||||||
// ToBlob converts the SDBlob to a normal data Blob
|
// ToBlob converts the SDBlob to a normal data Blob
|
||||||
func (s SDBlob) ToBlob() Blob {
|
func (s SDBlob) ToBlob() Blob {
|
||||||
jsonSD, err := json.Marshal(s)
|
jsonSD, err := json.Marshal(s)
|
||||||
|
|
Loading…
Add table
Reference in a new issue