package db import ( "context" "github.com/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) }