bsonenc

package
v2.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: GPL-3.0 Imports: 8 Imported by: 5

Documentation

Overview

Package bsonenc support encoding and decoding by bson.

Index

Constants

This section is empty.

Variables

View Source
var BSONEncoderHint = hint.MustNewHint("bson-encoder-v2.0.0")

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 BSONDecodable

type BSONDecodable interface {
	DecodeBSON([]byte, *Encoder) error
}

type Encoder

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

func NewEncoder

func NewEncoder() *Encoder

func (*Encoder) Add

func (enc *Encoder) Add(d encoder.DecodeDetail) error

func (*Encoder) AddHinter

func (enc *Encoder) AddHinter(hr hint.Hinter) error

func (*Encoder) Decode

func (enc *Encoder) Decode(b []byte) (interface{}, error)

func (*Encoder) DecodeSlice

func (enc *Encoder) DecodeSlice(b []byte) ([]interface{}, error)

func (*Encoder) DecodeWithFixedHintType

func (enc *Encoder) DecodeWithFixedHintType(s string, size int) (interface{}, error)

func (*Encoder) DecodeWithHint

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

func (*Encoder) DecodeWithHintType

func (enc *Encoder) DecodeWithHintType(b []byte, t hint.Type) (interface{}, error)

func (*Encoder) Hint

func (*Encoder) Hint() hint.Hint

func (*Encoder) Marshal

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

func (*Encoder) SetPool

func (enc *Encoder) SetPool(pool util.ObjectPool) *Encoder

func (*Encoder) StreamDecoder

func (*Encoder) StreamDecoder(r io.Reader) util.StreamDecoder

func (*Encoder) StreamEncoder

func (*Encoder) StreamEncoder(w io.Writer) util.StreamEncoder

func (*Encoder) Unmarshal

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

type HintedHead

type HintedHead struct {
	H string `bson:"_hint"`
}

Jump to

Keyboard shortcuts

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