utils

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: LGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendUnique

func AppendUnique(list []string, element string) []string

func CIDFromJSONBytes

func CIDFromJSONBytes(content []byte) (string, error)

CIDFromJSONBytes returns CID (cbor) for json (as bytes).

func CIDFromJSONBytesUsingIpldPrime

func CIDFromJSONBytesUsingIpldPrime(content []byte) (string, error)

CIDFromJSONBytesUsingIpldPrime returns CID (dagcbor) for json (as bytes). This is combination of samples for unmarshalling and linking see: https://pkg.go.dev/github.com/ipld/go-ipld-prime

func GenerateHash

func GenerateHash(json map[string]interface{}) (string, []byte, error)

GenerateHash returns the hash of the canonicalized JSON input.

func GenerateMnemonic

func GenerateMnemonic() (string, error)

func GetAttributeAsString

func GetAttributeAsString(obj map[string]interface{}, attr string) (string, error)

GetAttributeAsString returns a map attribute as string, if possible.

func Int64ToBytes

func Int64ToBytes(num int64) ([]byte, error)

func SetToSlice

func SetToSlice(set set.Set) []string

func SliceToSet

func SliceToSet(names []string) set.Set

Types

This section is empty.

Jump to

Keyboard shortcuts

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