cbornode

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2016 License: MIT Imports: 8 Imported by: 0

README

go-ipld-cbor

Coverage Status Travis CI

An implementation of a cbor encoded merkledag object.

Table of Contents

Install

make install

Usage

TODO: Right now this package isn't the easiest to use, it will be getting better rapidly, soon.

// Make an object
obj := map[interface{}]interface{}{
	"foo": "bar",
	"baz": &Link{
		Target: myCid,
	},
}

// Parse it into an ipldcbor node
nd, err := WrapMap(obj)

fmt.Println(nd.Links())

Contribute

PRs are welcome!

Small note: If editing the Readme, please conform to the standard-readme specification.

License

MIT © Jeromy Johnson

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSuchLink = errors.New("no such link found")

Functions

func DecodeInto

func DecodeInto(b []byte, v interface{}) error

DecodeInto decodes a serialized ipld cbor object into the given object.

func EncodeObject

func EncodeObject(obj interface{}) ([]byte, error)

Types

type Link struct {
	Target *cid.Cid `json:"/" cbor:"/"`
}

func (*Link) ToCBOR

func (l *Link) ToCBOR(w io.Writer, enc *cbor.Encoder) error

type Node

type Node struct {
	// contains filtered or unexported fields
}

func Decode

func Decode(b []byte) (*Node, error)

func WrapMap

func WrapMap(m map[interface{}]interface{}) (*Node, error)

func (Node) Cid

func (n Node) Cid() *cid.Cid
func (n Node) Links() []*node.Link

func (Node) Loggable

func (n Node) Loggable() map[string]interface{}

func (Node) MarshalJSON

func (n Node) MarshalJSON() ([]byte, error)

func (Node) RawData

func (n Node) RawData() []byte

func (Node) Resolve

func (n Node) Resolve(path []string) (interface{}, []string, error)
func (n Node) ResolveLink(path []string) (*node.Link, []string, error)

func (Node) Size

func (n Node) Size() (uint64, error)

func (Node) Stat

func (n Node) Stat() (*node.NodeStat, error)

func (Node) String

func (n Node) String() string

func (Node) Tree

func (n Node) Tree() []string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL