decode

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(b []byte) (schema.Notebook, error)

Bytes decodes raw JSON bytes into a version-specific notebook representation.

func RegisterDecoder

func RegisterDecoder(v schema.Version, d Decoder)

RegisterDecoder for a schema version.

Types

type Decoder

type Decoder interface {
	// ExtractCells accesses the array of notebook cells.
	//
	// Prior to v4.0 cells were not a part of the top level structure,
	// and were contained in "worksheets" instead.
	ExtractCells(data []byte) ([]json.RawMessage, error)

	// DecodeMeta decodes version-specific metadata.
	DecodeMeta(data []byte) (schema.NotebookMetadata, error)

	// DecodeCell decodes raw cell data to a version-specific implementation.
	DecodeCell(v map[string]interface{}, data []byte, meta schema.NotebookMetadata) (schema.Cell, error)
}

Decoder implementations are version-aware and decode cell contents and metadata based on the respective JSON schema definition.

Jump to

Keyboard shortcuts

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