converter

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Overview

Package converter generates a polyglot-encoded buffer from a signature schema and a data payload

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidSchema = errors.New("invalid schema")
	ErrInvalidData   = errors.New("invalid data")
)

Functions

func FromPolyglot

func FromPolyglot(schema *signature.Schema, decoder *polyglot.Decoder) (map[string]interface{}, error)

func ToPolyglot

func ToPolyglot(schema *signature.Schema, data map[string]interface{}, encoder *polyglot.BufferEncoder) error

Types

type Converter

type Converter struct {
	// contains filtered or unexported fields
}

Converter converts a signature schema and data payload into a polyglot-encoded buffer

func New

func New(schema *signature.Schema) (*Converter, error)

func (*Converter) FromPolyglot

func (p *Converter) FromPolyglot(decoder *polyglot.Decoder) (map[string]interface{}, error)

func (*Converter) ToPolyglot

func (p *Converter) ToPolyglot(data map[string]interface{}, encoder *polyglot.BufferEncoder) error

type Signature

type Signature struct {
	// contains filtered or unexported fields
}

func NewSignature

func NewSignature(schema *signature.Schema) (*Signature, error)

func (*Signature) Error

func (s *Signature) Error(err error) []byte

func (*Signature) FromJSON

func (s *Signature) FromJSON(b []byte) error

func (*Signature) Hash

func (s *Signature) Hash() string

func (*Signature) Read

func (s *Signature) Read(b []byte) (err error)

func (*Signature) Signature

func (s *Signature) Signature() *Signature

func (*Signature) ToJSON

func (s *Signature) ToJSON() ([]byte, error)

func (*Signature) Write

func (s *Signature) Write() []byte

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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