dshelp

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2021 License: MIT Imports: 4 Imported by: 2

README

go-ipfs-ds-help

DAOT Labs' fork of ipfs/go-ipfs-ds-help.

standard-readme compliant go.dev reference 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/daotl/go-ipfs-ds-help

Usage

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

Check the GoDoc documentation

Contribute

PRs accepted.

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

License

MIT

Copyright for portions of this fork are held by Protocol Labs, Inc. as part of the original go-ipfs-ds-help project. All other copyright for this fork are held by DAOT Labs. All rights reserved.

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(dsKey key.Key) ([]byte, error)

BinaryFromDsKey returns the byte slice corresponding to the given Key encoded with Base32.

func DsKeyToCidV1

func DsKeyToCidV1(dsKey key.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://pkg.go.dev/github.com/ipfs/go-cid#pkg-constants).

func DsKeyToMultihash

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

DsKeyToMultihash converts a Key to the corresponding Multihash.

func MultihashToStrKey

func MultihashToStrKey(k mh.Multihash) key.StrKey

MultihashToStrKey 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 NewStrKeyFromBinary

func NewStrKeyFromBinary(rawKey []byte) key.StrKey

NewStrKeyFromBinary creates a new StrKey from a byte slice using Base32 encoding.

Types

This section is empty.

Jump to

Keyboard shortcuts

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