iterator

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActivityTypeIDNewLead         = 12
	ActivityTypeIDChangeDataValue = 13
)

ActivityTypeID to capture required CDC events. For reference https://developers.marketo.com/blog/synchronizing-lead-data-changes-using-rest-api/

View Source
const (
	// is the maximum number of days between two snapshots. If the gap between two snapshots is greater than this number,
	// API will return an error. This is limitation of the API.
	MaximumHoursGap = 744 // 31 days in Hours
)

Variables

View Source
var ErrDone = errors.New("no more records in iterator")

Functions

This section is empty.

Types

type CDCIterator

type CDCIterator struct {
	// contains filtered or unexported fields
}

func NewCDCIterator

func NewCDCIterator(ctx context.Context, client *marketoclient.Client, pollingPeriod time.Duration, fields []string, lastModifiedTime time.Time, lastKey string) (*CDCIterator, error)

func (*CDCIterator) GetChangedLeadsIDs

func (c *CDCIterator) GetChangedLeadsIDs(ctx context.Context, token string) ([]int, map[int]int, error)

returns list of changed leads ids.

func (*CDCIterator) GetDeletedLeadsIDs

func (c *CDCIterator) GetDeletedLeadsIDs(ctx context.Context, token string) ([]int, error)

returns list of deleted leads ids.

func (*CDCIterator) HasNext

func (c *CDCIterator) HasNext(ctx context.Context) bool

returns true if there are more records to be read from the iterator's buffer, otherwise returns false.

func (*CDCIterator) Next

func (c *CDCIterator) Next(ctx context.Context) (sdk.Record, error)

returns Next record from the iterator's buffer, otherwise returns error.

func (*CDCIterator) Stop

func (c *CDCIterator) Stop()

type CombinedIterator

type CombinedIterator struct {
	// contains filtered or unexported fields
}

func NewCombinedIterator

func NewCombinedIterator(ctx context.Context, endpoint string, pollingPeriod time.Duration, client marketoclient.Client, p position.Position, fields []string, initialDate time.Time) (*CombinedIterator, error)

func (*CombinedIterator) HasNext

func (c *CombinedIterator) HasNext(ctx context.Context) bool

func (*CombinedIterator) Next

func (c *CombinedIterator) Next(ctx context.Context) (sdk.Record, error)

func (*CombinedIterator) Stop

func (c *CombinedIterator) Stop()

type Record

type Record struct {
	// contains filtered or unexported fields
}

custom Record type to handle CDC

type SnapshotIterator

type SnapshotIterator struct {
	// contains filtered or unexported fields
}

to handle snapshot iterator

func NewSnapshotIterator

func NewSnapshotIterator(ctx context.Context, endpoint string, fields []string, client marketoclient.Client, p position.Position, initialDate time.Time) (*SnapshotIterator, error)

returns NewSnapshotIterator with supplied parameters, also initiates the pull and flush goroutines.

func (*SnapshotIterator) HasNext

func (s *SnapshotIterator) HasNext(ctx context.Context) bool

returns true if there are more records to be read from the iterator's buffer, otherwise returns false.

func (*SnapshotIterator) Next

func (s *SnapshotIterator) Next(ctx context.Context) (sdk.Record, error)

returns Next record from the iterator's buffer, otherwise returns error.

Jump to

Keyboard shortcuts

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