Documentation
¶
Index ¶
- Constants
- func NamespaceIsCommand(ns string) bool
- func NamespaceToCollection(ns string) string
- func NamespaceToDB(ns string) string
- func SendMessage(ctx context.Context, m Message, writer io.Writer) error
- type CommandMessage
- type CommandReplyMessage
- type Message
- func NewCommand(db, name string, args, metadata *birch.Document, inputs []birch.Document) Message
- func NewCommandReply(reply, metadata *birch.Document, output []birch.Document) Message
- func NewDelete(ns string, flags int32, filter *birch.Document) Message
- func NewGetMore(ns string, number int32, cursorID int64) Message
- func NewInsert(ns string, docs ...*birch.Document) Message
- func NewKillCursors(ids ...int64) Message
- func NewOpMessage(moreToCome bool, documents []birch.Document, items ...model.SequenceItem) Message
- func NewQuery(ns string, flags, skip, toReturn int32, query, project *birch.Document) Message
- func NewReply(cursorID int64, flags, startingFrom, numReturned int32, docs []birch.Document) Message
- func NewUpdate(ns string, flags int32, filter, update *birch.Document) Message
- func ReadMessage(ctx context.Context, reader io.Reader) (Message, error)
- type MessageHeader
- type OpMessage
- type OpMessageSection
- type OpScope
- type OpType
- type ReplyMessage
Constants ¶
View Source
const ( OpMessageSectionBody = 0 OpMessageSectionDocumentSequence = 1 )
View Source
const MaxInt32 = 2147483647
Variables ¶
This section is empty.
Functions ¶
func NamespaceIsCommand ¶
func NamespaceToCollection ¶
func NamespaceToDB ¶
Types ¶
type CommandMessage ¶
type CommandMessage struct { DB string CmdName string CommandArgs *birch.Document Metadata *birch.Document InputDocs []birch.Document // contains filtered or unexported fields }
OP_COMMAND
func (*CommandMessage) HasResponse ¶
func (m *CommandMessage) HasResponse() bool
func (*CommandMessage) Header ¶
func (m *CommandMessage) Header() MessageHeader
func (*CommandMessage) Scope ¶
func (m *CommandMessage) Scope() *OpScope
func (*CommandMessage) Serialize ¶
func (m *CommandMessage) Serialize() []byte
type CommandReplyMessage ¶
type CommandReplyMessage struct { CommandReply *birch.Document Metadata *birch.Document OutputDocs []birch.Document // contains filtered or unexported fields }
OP_COMMAND_REPLY
func (*CommandReplyMessage) HasResponse ¶
func (m *CommandReplyMessage) HasResponse() bool
func (*CommandReplyMessage) Header ¶
func (m *CommandReplyMessage) Header() MessageHeader
func (*CommandReplyMessage) Scope ¶
func (m *CommandReplyMessage) Scope() *OpScope
func (*CommandReplyMessage) Serialize ¶
func (m *CommandReplyMessage) Serialize() []byte
type Message ¶
type Message interface { Header() MessageHeader Serialize() []byte HasResponse() bool Scope() *OpScope }
func NewCommand ¶
func NewCommandReply ¶
func NewKillCursors ¶
func NewOpMessage ¶
type MessageHeader ¶
type MessageHeader struct { Size int32 // total message size RequestID int32 ResponseTo int32 OpCode OpType }
func (*MessageHeader) WriteTo ¶
func (h *MessageHeader) WriteTo(wr io.Writer)
type OpMessage ¶
type OpMessage struct { Flags uint32 DB string Collection string Operation string Items []OpMessageSection Checksum int32 // contains filtered or unexported fields }
OP_MSG
func (*OpMessage) HasResponse ¶
func (*OpMessage) Header ¶
func (m *OpMessage) Header() MessageHeader
type OpMessageSection ¶
type ReplyMessage ¶
type ReplyMessage struct { Flags int32 CursorId int64 StartingFrom int32 NumberReturned int32 Docs []birch.Document // contains filtered or unexported fields }
OP_REPLY
func (*ReplyMessage) Header ¶
func (m *ReplyMessage) Header() MessageHeader
func (*ReplyMessage) Scope ¶
func (m *ReplyMessage) Scope() *OpScope
func (*ReplyMessage) Serialize ¶
func (m *ReplyMessage) Serialize() []byte
Click to show internal directories.
Click to hide internal directories.