MCPcopy Create free account
hub / github.com/gogs/gogs / GetObjectsByOIDs

Method GetObjectsByOIDs

internal/database/lfs.go:76–87  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

74// GetObjectsByOIDs returns LFS objects found within "oids". The returned list
75// could have fewer elements if some oids were not found.
76func (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}

Callers 2

lfsGetObjectsByOIDsFunction · 0.80
GetLFSObjectsByOIDsMethod · 0.80

Calls 2

WhereMethod · 0.80
FindMethod · 0.65

Tested by 1

lfsGetObjectsByOIDsFunction · 0.64