GetObjectsByOIDs returns LFS objects found within "oids". The returned list could have fewer elements if some oids were not found.
(ctx context.Context, repoID int64, oids ...lfsutil.OID)
| 74 | // GetObjectsByOIDs returns LFS objects found within "oids". The returned list |
| 75 | // could have fewer elements if some oids were not found. |
| 76 | func (s *LFSStore) GetObjectsByOIDs(ctx context.Context, repoID int64, oids ...lfsutil.OID) ([]*LFSObject, error) { |
| 77 | if len(oids) == 0 { |
| 78 | return []*LFSObject{}, nil |
| 79 | } |
| 80 | |
| 81 | objects := make([]*LFSObject, 0, len(oids)) |
| 82 | err := s.db.WithContext(ctx).Where("repo_id = ? AND oid IN (?)", repoID, oids).Find(&objects).Error |
| 83 | if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { |
| 84 | return nil, err |
| 85 | } |
| 86 | return objects, nil |
| 87 | } |