ormjson

package
v1.0.0-alpha.12 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RawMessageTarget

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

RawMessageTarget is a WriteTarget wrapping a raw JSON map.

func NewRawMessageTarget

func NewRawMessageTarget() *RawMessageTarget

NewRawMessageTarget returns a new WriteTarget where each table's JSON is written to a map key corresponding to the table's full protobuf name.

func (*RawMessageTarget) JSON

func (r *RawMessageTarget) JSON() (json.RawMessage, error)

JSON returns the JSON map that was written as a json.RawMessage.

func (*RawMessageTarget) OpenWriter

func (r *RawMessageTarget) OpenWriter(tableName protoreflect.FullName) (io.WriteCloser, error)

type ReadSource

type ReadSource interface {
	// OpenReader returns an io.ReadCloser for the named table. If there
	// is no JSON for this table, this method will return nil. It is
	// important the caller closes the reader when done with it.
	OpenReader(tableName protoreflect.FullName) (io.ReadCloser, error)
}

ReadSource is a source for reading tables in JSON format. It may abstract over a single JSON object or JSON in separate files that can be streamed over.

func NewRawMessageSource

func NewRawMessageSource(message json.RawMessage) (ReadSource, error)

NewRawMessageSource returns a new ReadSource for the provided json.RawMessage where it is assumed that the raw message is a JSON map where each table's JSON referenced by the map key corresponding to the tables full protobuf name.

type WriteTarget

type WriteTarget interface {
	// OpenWriter returns an io.WriteCloser for the named table. It is
	// important the caller closers the writer AND checks the error
	// when done with it.
	OpenWriter(tableName protoreflect.FullName) (io.WriteCloser, error)
}

WriteTarget is a target for writing tables in JSON format. It may abstract over a single JSON object or JSON in separate files that can be written incrementally.

Jump to

Keyboard shortcuts

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