message

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2014 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package message provides wrapper structs and helper methods to pipe actual database documents throughout transporter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandType

type CommandType int

CommandType represents the different Commands capable of being executed against a database.

const (

	// Flush is interpreted by the recieving sink adaptors to attempt to flush all buffered
	// operations to the database.  This can be useful when switching from a copy to a tail operation
	Flush CommandType = iota
)

Transporter understands the following different command types

type Msg

type Msg struct {
	Timestamp  int64
	Op         OpType
	ID         interface{}
	OriginalID interface{}
	// contains filtered or unexported fields
}

A Msg serves to wrap the actual document to provide additional metadata about the document being transported.

func NewMsg

func NewMsg(op OpType, doc bson.M) *Msg

NewMsg returns a new Msg with the ID extracted from the original document

func (*Msg) Document

func (m *Msg) Document() bson.M

Document returns the original doc, unaltered

func (*Msg) DocumentWithID

func (m *Msg) DocumentWithID(key string) bson.M

DocumentWithID returns the document with the id field attached to the specified key

func (*Msg) IDString

func (m *Msg) IDString() string

IDString returns the original id as a string value

func (*Msg) SetDocument

func (m *Msg) SetDocument(doc bson.M)

SetDocument will set the document variable and extract out the id and preserve it

type OpType

type OpType int

OpType represents the many different Operations being performed against a document (i.e. Insert, Update, etc.)

const (
	Insert OpType = iota
	Update
	Delete
	Command
	Unknown
)

messages refer to specific types database operations which are enumerated here.

func OpTypeFromString

func OpTypeFromString(s string) OpType

OpTypeFromString returns the constant representing the passed in string

func (OpType) String

func (o OpType) String() string

String returns the constant of the string representation of the OpType object.

Jump to

Keyboard shortcuts

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