dshelp

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2020 License: MIT Imports: 4 Imported by: 1

README

go-ipfs-ds-help

standard-readme compliant GoDoc Build Status

go-ipfs-ds-help provides utilities for parsing and creating datastore keys used by go-ipfs.

Table of Contents

Install

go-ipfs-ds-help works like a regular Go module:

> go get github.com/ipfs/go-ipfs-ds-help

Usage

import "github.com/ipfs/go-ipfs-ds-help"

Check the GoDoc documentation

This module uses Gx to manage dependencies. You can use make all to build it with the gx dependencies.

Contribute

PRs accepted.

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

License

MIT © Protocol Labs, Inc.

Documentation

Overview

Package dshelp provides utilities for parsing and creating datastore keys used by go-ipfs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinaryFromDsKey

func BinaryFromDsKey(k datastore.Key) ([]byte, error)

BinaryFromDsKey returns the byte slice corresponding to the given Key.

func DsKeyToCidV1

func DsKeyToCidV1(dsKey datastore.Key, codecType uint64) (cid.Cid, error)

DsKeyToCidV1Raw converts the given Key (which should be a raw multihash key) to a Cid V1 of the given type (see https://godoc.org/github.com/ipfs/go-cid#pkg-constants).

func DsKeyToMultihash

func DsKeyToMultihash(dsKey datastore.Key) (mh.Multihash, error)

DsKeyToMultihash converts a dsKey to the corresponding Multihash.

func MultihashToDsKey

func MultihashToDsKey(k mh.Multihash) datastore.Key

MultihashToDsKey creates a Key from the given Multihash. If working with Cids, you can call cid.Hash() to obtain the multihash. Note that different CIDs might represent the same multihash.

func NewKeyFromBinary

func NewKeyFromBinary(rawKey []byte) datastore.Key

NewKeyFromBinary creates a new key from a byte slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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