message

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: BSD-3-Clause Imports: 5 Imported by: 50

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
	// contains filtered or unexported fields
}

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) Confirms added in v0.4.0

func (m *Base) Confirms() chan struct{}

Confirms provides access to the underlying channel.

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).

func (*Base) UpdateNamespace added in v0.5.0

func (m *Base) UpdateNamespace(newNs string)

UpdateNamespace provides access to change the current namespace associated with the message.

type Msg

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

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

func WithConfirms added in v0.4.0

func WithConfirms(confirm chan struct{}, msg Msg) Msg

WithConfirms attaches a channel to be able to acknowledge message processing.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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