@cryptotaxi247 / kubo / commits / 96ab83432

feat(util) add u.Key().ToDatastore() method

Brian Tiger Chow committed Sep 13, 2014 at 17:05 UTC 96ab8343256fdfd39fa654940a7cb92d02666f9d
1 file changed +5
util/util.go
+5
@@ -8,6 +8,7 @@ import (
8 "path/filepath"
9 "strings"
10
11 + ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/datastore.go"
12 b58 "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-base58"
13 mh "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multihash"
14 )
@@ -31,6 +32,10 @@ var ErrNotFound = errors.New("Error: Not Found.")
32 // Key is a string representation of multihash for use with maps.
33 type Key string
34
35 +func (k Key) DatastoreKey() ds.Key {
36 + return ds.NewKey(string(k))
37 +}
38 +
39 func (k Key) Pretty() string {
40 return b58.Encode([]byte(k))
41 }