GetObjectByOID returns the LFS object with given OID. It returns ErrLFSObjectNotExist when not found.
(ctx context.Context, repoID int64, oid lfsutil.OID)
| 60 | // GetObjectByOID returns the LFS object with given OID. It returns |
| 61 | // ErrLFSObjectNotExist when not found. |
| 62 | func (s *LFSStore) GetObjectByOID(ctx context.Context, repoID int64, oid lfsutil.OID) (*LFSObject, error) { |
| 63 | object := new(LFSObject) |
| 64 | err := s.db.WithContext(ctx).Where("repo_id = ? AND oid = ?", repoID, oid).First(object).Error |
| 65 | if err != nil { |
| 66 | if errors.Is(err, gorm.ErrRecordNotFound) { |
| 67 | return nil, ErrLFSObjectNotExist{args: errutil.Args{"repoID": repoID, "oid": oid}} |
| 68 | } |
| 69 | return nil, err |
| 70 | } |
| 71 | return object, err |
| 72 | } |
| 73 | |
| 74 | // GetObjectsByOIDs returns LFS objects found within "oids". The returned list |
| 75 | // could have fewer elements if some oids were not found. |