Documentation ¶
Index ¶
- type Repo
- type Repository
- func (r *Repository) ExtendBlocks(blocks []models.Block) (extended []models.Block, err error)
- func (r *Repository) Filter(filter models.BlockFilter) (blocks []models.Block, err error)
- func (r *Repository) Find(filter models.Block) (found bool, block models.Block, err error)
- func (r *Repository) FindExtended(filter models.Block) (found bool, block models.Block, err error)
- func (r *Repository) Last() (block models.Block, err error)
- func (r *Repository) List(limit, offset uint, since uint64) (blocks []models.Block, err error)
- func (r *Repository) ListBlockAggregation(levels []int64) (blocks []models.BlockAggregationView, err error)
- func (r *Repository) ListExtended(limit, offset uint, since uint64) (blocks []models.Block, err error)
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 (*Repository) Filter ¶
func (r *Repository) Filter(filter models.BlockFilter) (blocks []models.Block, err error)
func (*Repository) FindExtended ¶
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 ¶
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. |