marshaller

package
v1.5.0-alpha13 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MaxNumberOfObjectsToSerialize = 1000

Arbitrarily choosing 1000 jobs to serialize - this is a pretty high

View Source
const MaxSerializedStringInput = int(10 * datasize.MB)

Variables

This section is empty.

Functions

func ConfirmMaxSliceSize

func ConfirmMaxSliceSize[T any](t T, maxSize int) error

func JSONMarshalIndentWithMax

func JSONMarshalIndentWithMax[T any](t T, indentSpaces int) ([]byte, error)

func JSONMarshalWithMax

func JSONMarshalWithMax[T any](t T) ([]byte, error)

func JSONUnmarshalWithMax

func JSONUnmarshalWithMax[T any](b []byte, t *T) error

func UnmarshalJob added in v1.4.0

func UnmarshalJob(in []byte) (*models.Job, error)

UnmarshalJob unmarshalled `in` into a models.Job. It returns an error if: - `in` cannot be marshaled to json. - `in` contains an un-settable or unknown field. - `in` cannot be marshaled into a models.Job.

func YAMLMarshalWithMax

func YAMLMarshalWithMax[T any](t T) ([]byte, error)

func YAMLUnmarshalWithMax

func YAMLUnmarshalWithMax[T any](b []byte, t *T) error

Types

type BinaryMarshaller added in v1.1.2

type BinaryMarshaller struct{}

BinaryMarshaller uses gob encoding for marshaling.

func NewBinaryMarshaller added in v1.1.2

func NewBinaryMarshaller() *BinaryMarshaller

NewBinaryMarshaller initializes and returns a new BinaryMarshaller.

func (BinaryMarshaller) Marshal added in v1.1.2

func (BinaryMarshaller) Marshal(obj interface{}) ([]byte, error)

Marshal converts the given object into a gob-encoded byte slice.

func (BinaryMarshaller) Unmarshal added in v1.1.2

func (BinaryMarshaller) Unmarshal(data []byte, obj interface{}) error

Unmarshal decodes gob data into the given object.

type JSONMarshaller added in v1.1.2

type JSONMarshaller struct{}

JSONMarshaller uses JSON encoding for marshaling.

func NewJSONMarshaller added in v1.1.2

func NewJSONMarshaller() *JSONMarshaller

NewJSONMarshaller initializes and returns a new JSONMarshaller.

func (JSONMarshaller) Marshal added in v1.1.2

func (JSONMarshaller) Marshal(obj interface{}) ([]byte, error)

Marshal converts the given object into a JSON byte slice.

func (JSONMarshaller) Unmarshal added in v1.1.2

func (JSONMarshaller) Unmarshal(data []byte, obj interface{}) error

Unmarshal decodes JSON data into the given object and normalizes it if applicable.

type KeyInt

type KeyInt int

type KeyString

type KeyString string

type Marshaller added in v1.1.2

type Marshaller interface {
	// Marshal converts the given object into a byte slice.
	Marshal(interface{}) ([]byte, error)
	// Unmarshal decodes data into the given object, and normalizes it if applicable.
	Unmarshal([]byte, interface{}) error
}

Marshaller defines methods for marshaling and unmarshaling data, and normalizing it if applicable.

Jump to

Keyboard shortcuts

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