block

package
v0.0.0-...-71505b4 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repo

type Repo interface {
	Last() (block models.Block, err error)
	List(limit, offset uint, since uint64) (blocks []models.Block, err error)
	Filter(filter models.BlockFilter) (blocks []models.Block, err error)
	Find(filter models.Block) (found bool, block models.Block, err error)
	FindExtended(filter models.Block) (found bool, block models.Block, err error)
	ListExtended(limit, offset uint, since uint64) (blocks []models.Block, err error)
}

type Repository

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

Repository is the block repo implementation.

func New

func New(db *gorm.DB) *Repository

New creates an instance of repository using the provided db.

func (*Repository) ExtendBlocks

func (r *Repository) ExtendBlocks(blocks []models.Block) (extended []models.Block, err error)

func (*Repository) Filter

func (r *Repository) Filter(filter models.BlockFilter) (blocks []models.Block, err error)

func (*Repository) Find

func (r *Repository) Find(filter models.Block) (found bool, block models.Block, err error)

Find looks up for blocks with filter.

func (*Repository) FindExtended

func (r *Repository) FindExtended(filter models.Block) (found bool, block models.Block, err error)

Find looks up for a block with filter and extends it with aggregated info.

func (*Repository) Last

func (r *Repository) Last() (block models.Block, err error)

Last returns the last added block.

func (*Repository) List

func (r *Repository) List(limit, offset uint, since uint64) (blocks []models.Block, err error)

List returns a list of blocks from the newest to oldest. limit defines the limit for the maximum number of blocks returned. since is used to paginate results based on the level. As the result is ordered descendingly the blocks with level < since will be returned.

func (*Repository) ListBlockAggregation

func (r *Repository) ListBlockAggregation(levels []int64) (blocks []models.BlockAggregationView, err error)

ListBlockAggregation returns a list of block aggreagation data for blocks in levels slice.

func (*Repository) ListExtended

func (r *Repository) ListExtended(limit, offset uint, since uint64) (blocks []models.Block, err error)

ListExtended returns a list of blocks with populated aggregation data from the newest to oldest. limit defines the limit for the maximum number of blocks returned. since is used to paginate results based on the level. As the result is ordered descendingly the blocks with level < since will be returned.

Directories

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

Jump to

Keyboard shortcuts

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