feat(store): add TaskStore CRUD and batch query methods for files and blobs
This commit is contained in:
@@ -82,6 +82,15 @@ func (s *BlobStore) Delete(ctx context.Context, sha256 string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *BlobStore) GetBySHA256s(ctx context.Context, sha256s []string) ([]model.FileBlob, error) {
|
||||
var blobs []model.FileBlob
|
||||
if len(sha256s) == 0 {
|
||||
return blobs, nil
|
||||
}
|
||||
err := s.db.WithContext(ctx).Where("sha256 IN ?", sha256s).Find(&blobs).Error
|
||||
return blobs, err
|
||||
}
|
||||
|
||||
// GetBySHA256ForUpdate returns the FileBlob with a SELECT ... FOR UPDATE lock.
|
||||
// Returns (nil, nil) if not found.
|
||||
func (s *BlobStore) GetBySHA256ForUpdate(ctx context.Context, tx *gorm.DB, sha256 string) (*model.FileBlob, error) {
|
||||
|
||||
Reference in New Issue
Block a user