mirror of
https://git.ptzo.gdn/feditools/relay.git
synced 2024-09-21 11:47:12 +00:00
1608ce9df1
Reviewed-on: https://git.ptzo.gdn/feditools/relay/pulls/162 Co-authored-by: Tyr Mactire <tyr@pettingzoo.co> Co-committed-by: Tyr Mactire <tyr@pettingzoo.co>
26 lines
1.1 KiB
Go
26 lines
1.1 KiB
Go
package db
|
|
|
|
import (
|
|
"context"
|
|
"git.ptzo.gdn/feditools/relay/internal/models"
|
|
)
|
|
|
|
type Block interface {
|
|
// CountBlocks returns the number of domain blocks
|
|
CountBlocks(ctx context.Context) (count int64, err Error)
|
|
// CreateBlockTX stores the domain block in a transaction.
|
|
CreateBlockTX(ctx context.Context, txID TxID, blocks ...*models.Block) (err Error)
|
|
// DeleteBlock deletes a domain block.
|
|
DeleteBlock(ctx context.Context, blocks ...*models.Block) (err Error)
|
|
// ReadBlock returns one domain block
|
|
ReadBlock(ctx context.Context, id int64) (block *models.Block, err Error)
|
|
// ReadBlockByDomain returns one domain block by domain name
|
|
ReadBlockByDomain(ctx context.Context, domain string) (block *models.Block, err Error)
|
|
// ReadBlocks returns all domain blocks
|
|
ReadBlocks(ctx context.Context) (blocks []*models.Block, err Error)
|
|
// ReadBlocksPage returns a page of domain blocks
|
|
ReadBlocksPage(ctx context.Context, index, count int) (blocks []*models.Block, err Error)
|
|
// UpdateBlockTX updates the stored domain block in a transaction
|
|
UpdateBlockTX(ctx context.Context, txID TxID, blocks ...*models.Block) (err Error)
|
|
}
|