Compare commits

...

6 Commits

Author SHA1 Message Date
Jeromy
6c7d9e3de2 gx publish 0.5.2 2016-10-05 12:08:42 -07:00
Jeromy
e5a96152bd gx publish 0.5.1 2016-10-05 11:37:05 -07:00
Jeromy
0f69fedd3a gx publish 0.5.0 2016-09-27 06:14:57 -07:00
Jeromy
595cace68a make cid's loggable 2016-09-27 06:14:46 -07:00
Jeromy
167239b405 gx publish 0.3.0 2016-09-27 03:43:09 -07:00
Jeromy
8522370eab gx publish 0.1.0 2016-09-04 11:52:09 -07:00
4 changed files with 24 additions and 12 deletions

View File

@@ -1 +1 @@
0.0.0: QmWzxM6XsNv1GoLs4dpQBay2NdMSWXRTFKmZwSHcsxg8ys
0.5.2: QmakyCk6Vnn16WEKjbkxieZmM2YLTzkFWizbmGowoYPjro

20
cid.go
View File

@@ -5,17 +5,17 @@ import (
"encoding/binary"
"fmt"
mh "github.com/jbenet/go-multihash"
mbase "github.com/multiformats/go-multibase"
mh "github.com/multiformats/go-multihash"
)
const UnsupportedVersionString = "<unsupported cid version>"
const (
Protobuf = iota
Raw
JSON
CBOR
Protobuf = 0x70
CBOR = 0x71
Raw = 0x72
JSON = 0x73
)
func NewCidV0(h mh.Multihash) *Cid {
@@ -164,3 +164,13 @@ func (c *Cid) UnmarshalJSON(b []byte) error {
func (c *Cid) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf("\"%s\"", c.String())), nil
}
func (c *Cid) KeyString() string {
return string(c.Bytes())
}
func (c *Cid) Loggable() map[string]interface{} {
return map[string]interface{}{
"cid": c,
}
}

View File

@@ -4,7 +4,7 @@ import (
"bytes"
"testing"
mh "github.com/jbenet/go-multihash"
mh "github.com/multiformats/go-multihash"
)
func assertEqual(t *testing.T, a, b *Cid) {

View File

@@ -1,17 +1,17 @@
{
"author": "whyrusleeping",
"bugs": {
"url": "https://github.com/multiformats/go-cid"
"url": "https://github.com/ipfs/go-cid"
},
"gx": {
"dvcsimport": "github.com/multiformats/go-cid"
"dvcsimport": "github.com/ipfs/go-cid"
},
"gxDependencies": [
{
"author": "whyrusleeping",
"hash": "QmYf7ng2hG5XBtJA3tN34DQ2GUN5HNksEw1rLDkmr6vGku",
"hash": "QmYDds3421prZgqKbLpEK7T9Aa2eVdQ7o3YarX1LVLdP2J",
"name": "go-multihash",
"version": "0.0.0"
"version": "1.0.0"
},
{
"author": "whyrusleeping",
@@ -24,5 +24,7 @@
"language": "go",
"license": "",
"name": "go-cid",
"version": "0.0.0"
"releaseCmd": "git commit -a -m \"gx publish $VERSION\"",
"version": "0.5.2"
}