* ref(index_rebuilder): mv to core * ref(idx_rebuilder): moved db acc code to repos * feat(idx_rebuilder): mv idx rebuilder to core and implemented build
28 lines
569 B
Go
28 lines
569 B
Go
package repositories
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/KristianJBorgwarth/dendrite.daemon/persistence"
|
|
)
|
|
|
|
type IIndexRepository interface {
|
|
WipeIndex(ctx context.Context, dbContext persistence.IDbContext) error
|
|
}
|
|
|
|
type indexRepository struct{
|
|
}
|
|
|
|
func NewIndexRepository() IIndexRepository {
|
|
return &indexRepository{}
|
|
}
|
|
|
|
func (r *indexRepository) WipeIndex(ctx context.Context, dbContext persistence.IDbContext) error {
|
|
cmd := `DELETE FROM note;
|
|
DELETE FROM tag;
|
|
DELETE FROM note_tag;
|
|
DELETE FROM link;`
|
|
|
|
_, err := dbContext.ExecContext(ctx, cmd)
|
|
return err
|
|
}
|