package msg
import "go.mongodb.org/mongo-driver/mongo/private/msg"
Package msg is not for public use.
The API for packages in the 'private' directory have no stability guarantee.
The packages within the 'private' directory would normally be put into an 'internal' directory to prohibit their use outside the 'mongo' directory. However, some MongoDB tools require very low-level access to the building blocks of a driver, so we have placed them under 'private' to allow these packages to be imported by projects that need them.
These package APIs may be modified in backwards-incompatible ways at any time.
You are strongly discouraged from directly using any packages under 'private'.
Index ¶
- func AddMeta(r Request, meta map[string]*bson.Document) error
- func CurrentRequestID() int32
- func NextRequestID() int32
- type Codec
- type Decoder
- type Encoder
- type Message
- type Query
- type QueryFlags
- type Reply
- type ReplyFlags
- type ReplyIter
- type Request
- type Response
Functions ¶
func AddMeta ¶
AddMeta wraps the query with meta data.
func CurrentRequestID ¶
func CurrentRequestID() int32
CurrentRequestID gets the current request id.
func NextRequestID ¶
func NextRequestID() int32
NextRequestID gets the next request id.
Types ¶
type Codec ¶
Codec encodes and decodes messages.
func NewWireProtocolCodec ¶
func NewWireProtocolCodec() Codec
NewWireProtocolCodec creates a MessageReadWriter for the binary message format.
type Decoder ¶
type Decoder interface { // Decode decodes one message from the reader. Decode(io.Reader) (Message, error) }
Decoder decodes messages.
type Encoder ¶
type Encoder interface { // Encode encodes a number of messages to the writer. Encode(io.Writer, ...Message) error }
Encoder encodes messages.
type Message ¶
type Message interface {
// contains filtered or unexported methods
}
Message represents a MongoDB message.
type Query ¶
type Query struct { ReqID int32 Flags QueryFlags FullCollectionName string NumberToSkip int32 NumberToReturn int32 Query interface{} ReturnFieldsSelector interface{} }
Query is a message sent to the server.
func (*Query) RequestID ¶
RequestID gets the request id of the message.
type QueryFlags ¶
type QueryFlags int32
QueryFlags are the flags in a Query.
const ( TailableCursor QueryFlags SlaveOK OplogReplay NoCursorTimeout AwaitData Exhaust Partial )
QueryFlags constants.
type Reply ¶
type Reply struct { ReqID int32 RespTo int32 ResponseFlags ReplyFlags CursorID int64 StartingFrom int32 NumberReturned int32 DocumentsBytes []byte }
Reply is a message received from the server.
func (*Reply) Iter ¶
Iter returns a ReplyIter to iterate over each document returned by the server.
func (*Reply) ResponseTo ¶
ResponseTo gets the request id the message was in response to.
type ReplyFlags ¶
type ReplyFlags int32
ReplyFlags are the flags in a Reply.
const ( CursorNotFound ReplyFlags = 1 << iota QueryFailure AwaitCapable )
ReplayMessageFlags constants.
type ReplyIter ¶
type ReplyIter struct {
// contains filtered or unexported fields
}
ReplyIter iterates over the documents returned in a Reply.
func (*ReplyIter) Err ¶
Err indicates if there was an error unmarshalling the last document attempted.
func (*ReplyIter) NextBytes ¶
NextBytes reads the next document and returns it as a bson.Reader.
type Request ¶
Request is a message sent to the server.
func NewCommand ¶
NewCommand creates a new RequestMessage to be set as a command.
type Response ¶
Response is a message received from the server.
Source Files ¶
codec.go codec_wireprotocol.go doc.go message.go message_command.go message_query.go message_reply.go
- Version
- v0.0.2
- Published
- Mar 6, 2018
- Platform
- js/wasm
- Imports
- 6 packages
- Last checked
- 2 hours ago –
Tools for package owners.