base

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2018 License: MIT Imports: 1 Imported by: 1

README

Common Go interfaces

This package provides a few common Go interfaces:

  • Iterator
  • Transaction (Tx)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Iterator

type Iterator interface {
	// Next advances an iterator.
	Next() bool
	// Err returns a last encountered error.
	Err() error
	// Close frees resources.
	Close() error
}

Iterator is a common interface implemented by all iterators that does not require a context.

type IteratorContext

type IteratorContext interface {
	// Next advances an iterator.
	Next(ctx context.Context) bool
	// Err returns a last encountered error.
	Err() error
	// Close frees resources.
	Close() error
}

IteratorContext is a common interface implemented by all iterators that are not bound to the context.

type Tx

type Tx interface {
	// Commit applies all changes made in the transaction.
	Commit(ctx context.Context) error
	// Close rolls back the transaction.
	// Committed transactions will not be affected by calling Close.
	Close() error
}

Tx is a common interface implemented by all transactions.

Jump to

Keyboard shortcuts

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