message

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2015 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
	Data      interface{}
}

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

func NewMsg

func NewMsg(op OpType, data interface{}) *Msg

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

func (*Msg) IDString

func (m *Msg) IDString(key string) (string, error)

IDString returns the original id as a string value

func (*Msg) IsMap added in v0.0.3

func (m *Msg) IsMap() bool

IsMap returns a bool indicating whether or not the msg.Data is maplike, i.e. a map[string]interface or a bson.M

func (*Msg) Map added in v0.0.3

func (m *Msg) Map() map[string]interface{}

Map casts the Msg.Data into a map[string]interface{}

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