cursor

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrClosed means the cursor has been closed already.
	ErrClosed = errors.New("cursor closed")
)

Functions

This section is empty.

Types

type Cursor

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

Cursor is a archive.Mail cursor.

func New

func New(mails ...archive.Mail) *Cursor

New returns a new *Cursor, initialized with the provided mails.

func (*Cursor) All

func (cur *Cursor) All(ctx context.Context) ([]archive.Mail, error)

All returns the remaining archive.Mails from the Cursor and calls cur.Close(ctx) afterwards.

It fails with ErrClosed if cur.Close() has been called before.

func (*Cursor) Close

func (cur *Cursor) Close(ctx context.Context) error

Close closes the Cursor and puts it in an unusable state. It fails with ErrClosed if cur.Close() has been called before.

func (*Cursor) Current

func (cur *Cursor) Current() archive.Mail

Current returns the current archive.Mail.

func (*Cursor) Err

func (cur *Cursor) Err() error

Err always returns nil.

func (*Cursor) Next

func (cur *Cursor) Next(ctx context.Context) bool

Next tries to advance the Cursor to the next mail. It returns false if the Cursor is already at the end, otherwise it returns true.

func (*Cursor) Push

func (cur *Cursor) Push(mails ...archive.Mail) error

Push adds mails to the end of the Cursor. It fails with ErrClosed if cur.Close() has been called before.

Jump to

Keyboard shortcuts

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