bsonenc

package
v0.0.0-...-5a6e01e Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package bsonenc support encoding and decoding instance by bson.

Index

Constants

This section is empty.

Variables

View Source
var (
	BSONEncoderType = hint.Type("bson-encoder")
	BSONEncoderHint = hint.NewHint(BSONEncoderType, "v0.0.1")
)

Functions

func Marshal

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

func MergeBSONM

func MergeBSONM(a bson.M, b ...bson.M) bson.M

func NewHintedDoc

func NewHintedDoc(h hint.Hint) bson.M

func Unmarshal

func Unmarshal(b []byte, v interface{}) error

Types

type Encoder

type Encoder struct {
	*hint.Hintset
	// contains filtered or unexported fields
}

func NewEncoder

func NewEncoder() *Encoder

func (*Encoder) Add

func (enc *Encoder) Add(ht hint.Hinter) error

func (*Encoder) Decode

func (enc *Encoder) Decode(b []byte) (hint.Hinter, error)

func (*Encoder) DecodeMap

func (enc *Encoder) DecodeMap(b []byte) (map[string]hint.Hinter, error)

func (*Encoder) DecodeSlice

func (enc *Encoder) DecodeSlice(b []byte) ([]hint.Hinter, error)

func (*Encoder) DecodeWithHint

func (enc *Encoder) DecodeWithHint(b []byte, ht hint.Hint) (hint.Hinter, error)

func (*Encoder) Hint

func (*Encoder) Hint() hint.Hint

func (*Encoder) Marshal

func (*Encoder) Marshal(v interface{}) ([]byte, error)

func (*Encoder) Unmarshal

func (*Encoder) Unmarshal(b []byte, v interface{}) error

type HintedHead

type HintedHead struct {
	H hint.Hint `bson:"_hint"`
}

type Unpackable

type Unpackable interface {
	UnpackBSON([]byte, *Encoder) error
}

Jump to

Keyboard shortcuts

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