...

Package codecutil

import "go.mongodb.org/mongo-driver/internal/codecutil"
Overview
Index

Overview ▾

Variables

var ErrNilValue = errors.New("value is nil")

func MarshalValue

func MarshalValue(val interface{}, encFn EncoderFn) (bsoncore.Value, error)

MarshalValue will attempt to encode the value with the encoder returned by the encoder function.

type EncoderFn

EncoderFn is used to functionally construct an encoder for marshaling values.

type EncoderFn func(io.Writer) (*bson.Encoder, error)

type MarshalError

MarshalError is returned when attempting to transform a value into a document results in an error.

type MarshalError struct {
    Value interface{}
    Err   error
}

func (MarshalError) Error

func (e MarshalError) Error() string

Error implements the error interface.