From 8514eebca6ca7b3213e879faa2a83c7e9ea6e181 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Wed, 11 Mar 2026 21:20:21 +0000 Subject: internal/api: implement package imported-by endpoint - Implement ServePackageImportedBy handler and GetImportedBy and GetImportedByCount datasource methods. Change-Id: I8c4cc65fbff7172eaf48e5426e4f3f41c82bd38e Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/754865 Reviewed-by: Jonathan Amsterdam kokoro-CI: kokoro LUCI-TryBot-Result: Go LUCI Auto-Submit: Ethan Lee --- internal/datasource.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'internal/datasource.go') diff --git a/internal/datasource.go b/internal/datasource.go index 59f0afa1..6cfc2110 100644 --- a/internal/datasource.go +++ b/internal/datasource.go @@ -97,6 +97,10 @@ type DataSource interface { GetModulePackages(ctx context.Context, modulePath, version string) ([]*PackageMeta, error) // GetSymbols returns symbols for the given unit and build context. GetSymbols(ctx context.Context, pkgPath, modulePath, version string, bc BuildContext) ([]*Symbol, error) + // GetImportedBy returns the paths of packages that import the given package. + GetImportedBy(ctx context.Context, pkgPath, modulePath string, limit int) ([]string, error) + // GetImportedByCount returns the number of packages that import the given package. + GetImportedByCount(ctx context.Context, pkgPath, modulePath string) (int, error) // SearchSupport reports the search types supported by this datasource. SearchSupport() SearchSupport -- cgit v1.3