As part of the new data model migration (#39629), we will have a single function get licenses for a given path (regardless of whether that path is a package, module, or directory).
This function will replace the existing LegacyGetPackageLicenses and LegacyGetModuleLicenses.
The function signature will be:
GetLicenses(ctx context.Context, fullpath, modulePath, resolvedVersion string)([]*licenses.License, error)
The function will execute the query below:
SELECT
l.types,
l.file_path,
l.contents,
l.coverage
FROM
licenses l
INNER JOIN
paths p
ON
p.module_id=l.module_id
INNER JOIN
modules m
ON
p.module_id=m.id
WHERE
p.path = $1
AND m.module_path = $2
AND m.version = $3;
Only licenses relevant to the path should be returned. A license applies to the path if the license is in the path directory, or any of its parent directories.
As part of the new data model migration (#39629), we will have a single function get licenses for a given path (regardless of whether that path is a package, module, or directory).
This function will replace the existing LegacyGetPackageLicenses and LegacyGetModuleLicenses.
The function signature will be:
The function will execute the query below:
Only licenses relevant to the path should be returned. A license applies to the path if the license is in the path directory, or any of its parent directories.