From 96ab8343256fdfd39fa654940a7cb92d02666f9d Mon Sep 17 00:00:00 2001 From: Brian Tiger Chow Date: Sat, 13 Sep 2014 17:05:12 -0700 Subject: [PATCH] feat(util) add u.Key().ToDatastore() method --- util/util.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/util/util.go b/util/util.go index 9c17fe0e6..d2a432789 100644 --- a/util/util.go +++ b/util/util.go @@ -8,6 +8,7 @@ import ( "path/filepath" "strings" + ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/datastore.go" b58 "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-base58" mh "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multihash" ) @@ -31,6 +32,10 @@ var ErrNotFound = errors.New("Error: Not Found.") // Key is a string representation of multihash for use with maps. type Key string +func (k Key) DatastoreKey() ds.Key { + return ds.NewKey(string(k)) +} + func (k Key) Pretty() string { return b58.Encode([]byte(k)) }