marshaler

package
v0.73.2 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: Apache-2.0 Imports: 4 Imported by: 33

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AbstractMarshaler

type AbstractMarshaler JSONMarshaler

AbstractMarshaler is deprecated.

type BufferContext

type BufferContext struct {
	CompressorInput   *bytes.Buffer
	CompressorOutput  *bytes.Buffer
	PrecompressionBuf *bytes.Buffer
}

BufferContext contains the buffers used for MarshalSplitCompress so they can be shared between invocations

func NewBufferContext

func NewBufferContext() *BufferContext

NewBufferContext initialize the default compression buffers

type DummyMarshaller

type DummyMarshaller struct {
	Items  []string
	Header string
	Footer string
}

DummyMarshaller implements StreamJSONMarshaler for unit tests.

func (*DummyMarshaller) DescribeItem

func (d *DummyMarshaller) DescribeItem(i int) string

DescribeItem returns a text description for logs

func (*DummyMarshaller) Len

func (d *DummyMarshaller) Len() int

Len returns the number of items to marshal

func (*DummyMarshaller) Marshal

func (d *DummyMarshaller) Marshal() ([]byte, error)

Marshal not implemented

func (*DummyMarshaller) MarshalJSON

func (d *DummyMarshaller) MarshalJSON() ([]byte, error)

MarshalJSON not implemented

func (*DummyMarshaller) WriteFooter

func (d *DummyMarshaller) WriteFooter(stream *jsoniter.Stream) error

WriteFooter writes the payload footer for this type

func (*DummyMarshaller) WriteHeader

func (d *DummyMarshaller) WriteHeader(stream *jsoniter.Stream) error

WriteHeader writes the payload header for this type

func (*DummyMarshaller) WriteItem

func (d *DummyMarshaller) WriteItem(stream *jsoniter.Stream, i int) error

WriteItem writes the json representation of an item

type IterableStreamJSONMarshaler

type IterableStreamJSONMarshaler interface {
	WriteHeader(*jsoniter.Stream) error
	WriteFooter(*jsoniter.Stream) error
	WriteCurrentItem(*jsoniter.Stream) error
	DescribeCurrentItem() string
	MoveNext() bool
	GetCurrentItemPointCount() int
}

IterableStreamJSONMarshaler is an interface for iterable metrics that are able to serialize themselves in a stream. Expected usage:

	m.WriteHeader(stream)
	for m.MoveNext() {
		m.WriteCurrentItem(stream)
 }
	m.WriteFooter(stream)

type IterableStreamJSONMarshalerAdapter

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

IterableStreamJSONMarshalerAdapter adapts an object implementing `StreamJSONMarshaler` into an object implementing `IterableStreamJSONMarshaler`

func NewIterableStreamJSONMarshalerAdapter

func NewIterableStreamJSONMarshalerAdapter(marshaler StreamJSONMarshaler) *IterableStreamJSONMarshalerAdapter

NewIterableStreamJSONMarshalerAdapter creates an new instance of `IterableStreamJSONMarshalerAdapter`

func (*IterableStreamJSONMarshalerAdapter) DescribeCurrentItem

func (a *IterableStreamJSONMarshalerAdapter) DescribeCurrentItem() string

DescribeCurrentItem returns a text description

func (*IterableStreamJSONMarshalerAdapter) GetCurrentItemPointCount

func (a *IterableStreamJSONMarshalerAdapter) GetCurrentItemPointCount() int

GetCurrentItemPointCount gets the number of points in the current item

func (*IterableStreamJSONMarshalerAdapter) MoveNext

MoveNext moves to the next value. Returns false when reaching the end of the iteration.

func (*IterableStreamJSONMarshalerAdapter) WriteCurrentItem

func (a *IterableStreamJSONMarshalerAdapter) WriteCurrentItem(j *jsoniter.Stream) error

WriteCurrentItem writes the json representation into the stream

func (*IterableStreamJSONMarshalerAdapter) WriteFooter

WriteFooter writes the payload footer for this type

func (*IterableStreamJSONMarshalerAdapter) WriteHeader

WriteHeader writes the payload header for this type

type JSONMarshaler

type JSONMarshaler interface {
	// MarshalJSON serialization a Payload to JSON
	MarshalJSON() ([]byte, error)
}

JSONMarshaler is a AbstractMarshaler that implement JSON marshaling.

type StreamJSONMarshaler

type StreamJSONMarshaler interface {
	WriteHeader(*jsoniter.Stream) error
	WriteFooter(*jsoniter.Stream) error
	WriteItem(*jsoniter.Stream, int) error
	Len() int
	DescribeItem(i int) string
}

StreamJSONMarshaler is an interface for metrics that are able to serialize themselves in a stream

Jump to

Keyboard shortcuts

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