cbornode

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2017 License: MIT Imports: 11 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

View Source
const CBORTagLink = 42

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 DumpObject added in v0.5.0

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

func EncoderFilter added in v0.5.0

func EncoderFilter(i interface{}) interface{}

Types

type IpldLinkDecoder added in v0.5.0

type IpldLinkDecoder struct{}

func (*IpldLinkDecoder) DecodeTarget added in v0.5.0

func (d *IpldLinkDecoder) DecodeTarget() interface{}

func (*IpldLinkDecoder) GetTag added in v0.5.0

func (d *IpldLinkDecoder) GetTag() uint64

func (*IpldLinkDecoder) PostDecode added in v0.5.0

func (d *IpldLinkDecoder) PostDecode(i interface{}) (interface{}, error)

type Node

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

func Decode

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

func FromJson added in v0.3.0

func FromJson(r io.Reader) (*Node, error)

func WrapObject added in v1.0.0

func WrapObject(m interface{}) (*Node, error)

func (Node) Cid

func (n Node) Cid() *cid.Cid

func (*Node) Copy added in v0.4.0

func (n *Node) Copy() node.Node
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(path string, depth int) []string

Jump to

Keyboard shortcuts

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