bsonrwtest

package
v0.0.0-...-b6f9f64 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package bsonrwtest provides utilities for testing the "bson/bsonrw" package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Invoked

type Invoked byte

Invoked is a type used to indicate what method was called last.

const (
	Nothing Invoked = iota
	ReadArray
	ReadBinary
	ReadBoolean
	ReadDocument
	ReadCodeWithScope
	ReadDBPointer
	ReadDateTime
	ReadDecimal128
	ReadDouble
	ReadInt32
	ReadInt64
	ReadJavascript
	ReadMaxKey
	ReadMinKey
	ReadNull
	ReadObjectID
	ReadRegex
	ReadString
	ReadSymbol
	ReadTimestamp
	ReadUndefined
	ReadElement
	ReadValue
	WriteArray
	WriteBinary
	WriteBinaryWithSubtype
	WriteBoolean
	WriteCodeWithScope
	WriteDBPointer
	WriteDateTime
	WriteDecimal128
	WriteDouble
	WriteInt32
	WriteInt64
	WriteJavascript
	WriteMaxKey
	WriteMinKey
	WriteNull
	WriteObjectID
	WriteRegex
	WriteString
	WriteDocument
	WriteSymbol
	WriteTimestamp
	WriteUndefined
	WriteDocumentElement
	WriteDocumentEnd
	WriteArrayElement
	WriteArrayEnd
	Skip
)

These are the different methods that can be invoked.

func (Invoked) String

func (i Invoked) String() string

type ValueReaderWriter

type ValueReaderWriter struct {
	T        *testing.T
	Invoked  Invoked
	Return   interface{} // Can be a primitive or a bsoncore.Value
	BSONType bsontype.Type
	Err      error
	ErrAfter Invoked // error after this method is called
	// contains filtered or unexported fields
}

ValueReaderWriter is a test implementation of a bsonrw.ValueReader and bsonrw.ValueWriter

func (*ValueReaderWriter) ReadArray

func (llvrw *ValueReaderWriter) ReadArray() (bsonrw.ArrayReader, error)

ReadArray implements the bsonrw.ValueReader interface.

func (*ValueReaderWriter) ReadBinary

func (llvrw *ValueReaderWriter) ReadBinary() (b []byte, btype byte, err error)

ReadBinary implements the bsonrw.ValueReader interface.

func (*ValueReaderWriter) ReadBoolean

func (llvrw *ValueReaderWriter) ReadBoolean() (bool, error)

ReadBoolean implements the bsonrw.ValueReader interface.

func (*ValueReaderWriter) ReadCodeWithScope

func (llvrw *ValueReaderWriter) ReadCodeWithScope() (code string, dr bsonrw.DocumentReader, err error)

ReadCodeWithScope implements the bsonrw.ValueReader interface.

func (*ValueReaderWriter) ReadDBPointer

func (llvrw *ValueReaderWriter) ReadDBPointer() (ns string, oid primitive.ObjectID, err error)

ReadDBPointer implements the bsonrw.ValueReader interface.

func (*ValueReaderWriter) ReadDateTime

func (llvrw *ValueReaderWriter) ReadDateTime() (int64, error)

ReadDateTime implements the bsonrw.ValueReader interface.

func (*ValueReaderWriter) ReadDecimal128

func (llvrw *ValueReaderWriter) ReadDecimal128() (primitive.Decimal128, error)

ReadDecimal128 implements the bsonrw.ValueReader interface.

func (*ValueReaderWriter) ReadDocument

func (llvrw *ValueReaderWriter) ReadDocument() (bsonrw.DocumentReader, error)

ReadDocument implements the bsonrw.ValueReader interface.

func (*ValueReaderWriter) ReadDouble

func (llvrw *ValueReaderWriter) ReadDouble() (float64, error)

ReadDouble implements the bsonrw.ValueReader interface.

func (*ValueReaderWriter) ReadElement

func (llvrw *ValueReaderWriter) ReadElement() (string, bsonrw.ValueReader, error)

ReadElement implements the bsonrw.DocumentReader interface.

func (*ValueReaderWriter) ReadInt32

func (llvrw *ValueReaderWriter) ReadInt32() (int32, error)

ReadInt32 implements the bsonrw.ValueReader interface.

func (*ValueReaderWriter) ReadInt64

func (llvrw *ValueReaderWriter) ReadInt64() (int64, error)

ReadInt64 implements the bsonrw.ValueReader interface.

func (*ValueReaderWriter) ReadJavascript

func (llvrw *ValueReaderWriter) ReadJavascript() (code string, err error)

ReadJavascript implements the bsonrw.ValueReader interface.

func (*ValueReaderWriter) ReadMaxKey

func (llvrw *ValueReaderWriter) ReadMaxKey() error

ReadMaxKey implements the bsonrw.ValueReader interface.

func (*ValueReaderWriter) ReadMinKey

func (llvrw *ValueReaderWriter) ReadMinKey() error

ReadMinKey implements the bsonrw.ValueReader interface.

func (*ValueReaderWriter) ReadNull

func (llvrw *ValueReaderWriter) ReadNull() error

ReadNull implements the bsonrw.ValueReader interface.

func (*ValueReaderWriter) ReadObjectID

func (llvrw *ValueReaderWriter) ReadObjectID() (primitive.ObjectID, error)

ReadObjectID implements the bsonrw.ValueReader interface.

func (*ValueReaderWriter) ReadRegex

func (llvrw *ValueReaderWriter) ReadRegex() (pattern string, options string, err error)

ReadRegex implements the bsonrw.ValueReader interface.

func (*ValueReaderWriter) ReadString

func (llvrw *ValueReaderWriter) ReadString() (string, error)

ReadString implements the bsonrw.ValueReader interface.

func (*ValueReaderWriter) ReadSymbol

func (llvrw *ValueReaderWriter) ReadSymbol() (symbol string, err error)

ReadSymbol implements the bsonrw.ValueReader interface.

func (*ValueReaderWriter) ReadTimestamp

func (llvrw *ValueReaderWriter) ReadTimestamp() (t uint32, i uint32, err error)

ReadTimestamp implements the bsonrw.ValueReader interface.

func (*ValueReaderWriter) ReadUndefined

func (llvrw *ValueReaderWriter) ReadUndefined() error

ReadUndefined implements the bsonrw.ValueReader interface.

func (*ValueReaderWriter) ReadValue

func (llvrw *ValueReaderWriter) ReadValue() (bsonrw.ValueReader, error)

ReadValue implements the bsonrw.ArrayReader interface.

func (*ValueReaderWriter) Skip

func (llvrw *ValueReaderWriter) Skip() error

Skip implements the bsonrw.ValueReader interface.

func (*ValueReaderWriter) Type

func (llvrw *ValueReaderWriter) Type() bsontype.Type

Type implements the bsonrw.ValueReader interface.

func (*ValueReaderWriter) WriteArray

func (llvrw *ValueReaderWriter) WriteArray() (bsonrw.ArrayWriter, error)

WriteArray implements the bsonrw.ValueWriter interface.

func (*ValueReaderWriter) WriteArrayElement

func (llvrw *ValueReaderWriter) WriteArrayElement() (bsonrw.ValueWriter, error)

WriteArrayElement implements the bsonrw.ArrayWriter interface.

func (*ValueReaderWriter) WriteArrayEnd

func (llvrw *ValueReaderWriter) WriteArrayEnd() error

WriteArrayEnd implements the bsonrw.ArrayWriter interface.

func (*ValueReaderWriter) WriteBinary

func (llvrw *ValueReaderWriter) WriteBinary([]byte) error

WriteBinary implements the bsonrw.ValueWriter interface.

func (*ValueReaderWriter) WriteBinaryWithSubtype

func (llvrw *ValueReaderWriter) WriteBinaryWithSubtype([]byte, byte) error

WriteBinaryWithSubtype implements the bsonrw.ValueWriter interface.

func (*ValueReaderWriter) WriteBoolean

func (llvrw *ValueReaderWriter) WriteBoolean(bool) error

WriteBoolean implements the bsonrw.ValueWriter interface.

func (*ValueReaderWriter) WriteCodeWithScope

func (llvrw *ValueReaderWriter) WriteCodeWithScope(string) (bsonrw.DocumentWriter, error)

WriteCodeWithScope implements the bsonrw.ValueWriter interface.

func (*ValueReaderWriter) WriteDBPointer

func (llvrw *ValueReaderWriter) WriteDBPointer(string, primitive.ObjectID) error

WriteDBPointer implements the bsonrw.ValueWriter interface.

func (*ValueReaderWriter) WriteDateTime

func (llvrw *ValueReaderWriter) WriteDateTime(int64) error

WriteDateTime implements the bsonrw.ValueWriter interface.

func (*ValueReaderWriter) WriteDecimal128

func (llvrw *ValueReaderWriter) WriteDecimal128(primitive.Decimal128) error

WriteDecimal128 implements the bsonrw.ValueWriter interface.

func (*ValueReaderWriter) WriteDocument

func (llvrw *ValueReaderWriter) WriteDocument() (bsonrw.DocumentWriter, error)

WriteDocument implements the bsonrw.ValueWriter interface.

func (*ValueReaderWriter) WriteDocumentElement

func (llvrw *ValueReaderWriter) WriteDocumentElement(string) (bsonrw.ValueWriter, error)

WriteDocumentElement implements the bsonrw.DocumentWriter interface.

func (*ValueReaderWriter) WriteDocumentEnd

func (llvrw *ValueReaderWriter) WriteDocumentEnd() error

WriteDocumentEnd implements the bsonrw.DocumentWriter interface.

func (*ValueReaderWriter) WriteDouble

func (llvrw *ValueReaderWriter) WriteDouble(float64) error

WriteDouble implements the bsonrw.ValueWriter interface.

func (*ValueReaderWriter) WriteInt32

func (llvrw *ValueReaderWriter) WriteInt32(int32) error

WriteInt32 implements the bsonrw.ValueWriter interface.

func (*ValueReaderWriter) WriteInt64

func (llvrw *ValueReaderWriter) WriteInt64(int64) error

WriteInt64 implements the bsonrw.ValueWriter interface.

func (*ValueReaderWriter) WriteJavascript

func (llvrw *ValueReaderWriter) WriteJavascript(string) error

WriteJavascript implements the bsonrw.ValueWriter interface.

func (*ValueReaderWriter) WriteMaxKey

func (llvrw *ValueReaderWriter) WriteMaxKey() error

WriteMaxKey implements the bsonrw.ValueWriter interface.

func (*ValueReaderWriter) WriteMinKey

func (llvrw *ValueReaderWriter) WriteMinKey() error

WriteMinKey implements the bsonrw.ValueWriter interface.

func (*ValueReaderWriter) WriteNull

func (llvrw *ValueReaderWriter) WriteNull() error

WriteNull implements the bsonrw.ValueWriter interface.

func (*ValueReaderWriter) WriteObjectID

func (llvrw *ValueReaderWriter) WriteObjectID(primitive.ObjectID) error

WriteObjectID implements the bsonrw.ValueWriter interface.

func (*ValueReaderWriter) WriteRegex

func (llvrw *ValueReaderWriter) WriteRegex(string, string) error

WriteRegex implements the bsonrw.ValueWriter interface.

func (*ValueReaderWriter) WriteString

func (llvrw *ValueReaderWriter) WriteString(string) error

WriteString implements the bsonrw.ValueWriter interface.

func (*ValueReaderWriter) WriteSymbol

func (llvrw *ValueReaderWriter) WriteSymbol(string) error

WriteSymbol implements the bsonrw.ValueWriter interface.

func (*ValueReaderWriter) WriteTimestamp

func (llvrw *ValueReaderWriter) WriteTimestamp(uint32, uint32) error

WriteTimestamp implements the bsonrw.ValueWriter interface.

func (*ValueReaderWriter) WriteUndefined

func (llvrw *ValueReaderWriter) WriteUndefined() error

WriteUndefined implements the bsonrw.ValueWriter interface.

Jump to

Keyboard shortcuts

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