multischema

package
v0.0.0-...-55235b3 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IDENTITY = 0x00
	JSON     = 0x11
)

constants

Variables

View Source
var (
	ErrUnknownType                    = errors.New("multischema type not supported yet")
	ErrSchemaNotConfrontedToValidator = errors.New("schema not confronted to validator")
)

errors

View Source
var CodeToTypeMap = map[byte]string{
	IDENTITY: "identity",
	JSON:     "json",
}

CodeToTypeMap maps a hash code to it's type

View Source
var TypeToCodeMap = map[string]byte{
	"identity": IDENTITY,
	"json":     JSON,
}

TypeToCodeMap maps the type of a hash to the code

Functions

func EncodePayloadToMultiHash

func EncodePayloadToMultiHash(payload []byte) ([]byte, error)

EncodePayloadToMultiHash returns payload encoded with sha3 in MultiHash format

Types

type SchemaId

type SchemaId []byte

func EncodeToSchemaId

func EncodeToSchemaId(schemaType string, payload []byte) (SchemaId, error)

EncodeToSchemaId returns SchemaHash in the format of <SchemaCode 1 byte><Multihash>

func SchemaIdFromHexString

func SchemaIdFromHexString(str string) (SchemaId, error)

func (SchemaId) Bytes

func (sId SchemaId) Bytes() []byte

func (SchemaId) String

func (sId SchemaId) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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