Documentation
¶
Overview ¶
Package driver provides low-level wire protocol driver for testing.
Index ¶
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) Read() (*wire.MsgHeader, wire.MsgBody, error)
- func (c *Conn) Request(ctx context.Context, header *wire.MsgHeader, body wire.MsgBody) (*wire.MsgHeader, wire.MsgBody, error)
- func (c *Conn) Write(header *wire.MsgHeader, body wire.MsgBody) error
- func (c *Conn) WriteRaw(b []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn represents a single connection.
It is not safe for concurrent use.
Logger is used only with debug level.
func Connect ¶
Connect creates a new connection for the given MongoDB URI and logger.
Context can be used to cancel the connection attempt. Canceling the context after the connection is established has no effect.
func (*Conn) Request ¶
func (c *Conn) Request(ctx context.Context, header *wire.MsgHeader, body wire.MsgBody) (*wire.MsgHeader, wire.MsgBody, error)
Request sends the given request to the connection and returns the response. If header MessageLength or RequestID is not specified, it assigns the proper values. For header.OpCode the wire.OpCodeMsg is used as default.
It returns errors only for request/response parsing issues, or connection issues. All of the driver level errors are stored inside response.