message

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2017 License: BSD-3-Clause Imports: 5 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 Base

type Base struct {
	TS        int64
	NS        string
	Operation ops.Op
	MapData   data.Data
}

Base represents a standard message format for transporter data if it does not meet your need, you can embed the struct and override whatever methods needed to accurately represent the data structure.

func (*Base) Data

func (m *Base) Data() data.Data

Data returns the internal representation of the document as the data.Data type

func (*Base) ID

func (m *Base) ID() string

ID will attempt to convert the _id field into a string representation

func (*Base) Namespace

func (m *Base) Namespace() string

Namespace returns the combination of database/table/colleciton for the underlying adaptor.

func (*Base) OP

func (m *Base) OP() ops.Op

OP returns the type of operation the message is associated with (i.e. insert/update/delete).

func (*Base) Timestamp

func (m *Base) Timestamp() int64

Timestamp returns the time the object was created in transporter (i.e. it has no correlation with any time in the database).

type Msg

type Msg interface {
	ID() string
	OP() ops.Op
	Timestamp() int64
	Data() data.Data
	Namespace() string
}

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

func From

func From(op ops.Op, namespace string, d data.Data) Msg

From builds a message.Msg specific to an elasticsearch document

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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