mdbson

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package mdbson supports serialization and deserialization using BSON. Objects with interface fields are serialized and deserialized using madkins23/go-type/reg. This package is patterned after JSON and YAML code in madkins23/go-serial.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Wrapper

type Wrapper[T any] struct {
	// contains filtered or unexported fields
}

Wrapper is used to attach a type name to an item to be serialized. This supports re-creating the correct type for filling an interface field.

func Wrap

func Wrap[W any](item W) *Wrapper[W]

Wrap an item in a BSON wrapper that can handle serialization.

func (*Wrapper[T]) Get

func (w *Wrapper[T]) Get() T

Get the wrapped item.

func (*Wrapper[T]) MarshalBSON

func (w *Wrapper[T]) MarshalBSON() ([]byte, error)

func (*Wrapper[T]) Set

func (w *Wrapper[T]) Set(t T)

Set the wrapped item.

func (*Wrapper[T]) UnmarshalBSON

func (w *Wrapper[T]) UnmarshalBSON(marshaled []byte) error

Jump to

Keyboard shortcuts

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