codec

package
v1.22.41 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package codec provides encoding/decoding for consensus types

Index

Constants

This section is empty.

Variables

View Source
var Codec = &JSONCodec{}

Codec provides marshaling/unmarshaling

Functions

This section is empty.

Types

type CodecVersion

type CodecVersion uint16

CodecVersion represents the codec version

const (
	// CurrentVersion is the current codec version
	CurrentVersion CodecVersion = 0
)

type JSONCodec

type JSONCodec struct{}

JSONCodec implements JSON encoding/decoding

func (*JSONCodec) Marshal

func (c *JSONCodec) Marshal(version CodecVersion, v interface{}) ([]byte, error)

Marshal marshals an object to bytes

func (*JSONCodec) Unmarshal

func (c *JSONCodec) Unmarshal(data []byte, v interface{}) (CodecVersion, error)

Unmarshal unmarshals bytes to an object

Jump to

Keyboard shortcuts

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