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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CDC

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

A CDC represents a struct of cdc iterator.

func NewCDC

func NewCDC(stripeSvc Stripe, pos *Position) *CDC

NewCDC initializes cdc iterator.

func (*CDC) Next

func (i *CDC) Next() (sdk.Record, error)

Next returns the next record.

type Iterator

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

An Iterator represents a struct of iterator.

func New

func New(stripeSvc Stripe, pos *Position) *Iterator

New initializes an iterator.

func (*Iterator) Next

func (iter *Iterator) Next() (sdk.Record, error)

Next returns the next record.

type Position

type Position struct {
	// Mode represents current iterator mode.
	IteratorMode mode `json:"mode"`

	// CreatedAt is the Unix time from which the system should receive events of the resource in the CDC iterator.
	CreatedAt int64 `json:"created_at"`

	// Cursor is the resource or event identifier for receiving shifted data in the following requests.
	Cursor string `json:"cursor"`

	// Index is the current index of the returning record from the batch of previously received resources.
	Index int `json:"index"`
}

Position represents Oracle position.

func ParseSDKPosition

func ParseSDKPosition(position sdk.Position) (*Position, error)

ParseSDKPosition parses sdk.Position and returns Position.

type Snapshot

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

A Snapshot represents a struct of snapshot iterator.

func NewSnapshot

func NewSnapshot(stripeSvc Stripe, pos *Position) *Snapshot

NewSnapshot initializes snapshot iterator.

func (*Snapshot) Next

func (i *Snapshot) Next() (sdk.Record, error)

Next returns the next record. Note: The `Snapshot` iterator creates a copy of the data, which is sorted by date of creation in descending order.

type Stripe

type Stripe interface {
	GetResource(string) (models.ResourceResponse, error)
	GetEvent(createdAt int64, startingAfter, endingBefore string) (models.EventResponse, error)
}

A Stripe defines the interface of methods.

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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