diff options
| author | Ethan Lee <ethanalee@google.com> | 2026-03-11 21:20:21 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2026-03-30 13:26:49 -0700 |
| commit | 8514eebca6ca7b3213e879faa2a83c7e9ea6e181 (patch) | |
| tree | 85db643baa162d5a828895d3655b8e1fd3f5c9af /internal/datasource.go | |
| parent | 46b63f3ffddc9657bc2c45fb116dc49c0b381a34 (diff) | |
| download | go-x-pkgsite-8514eebca6ca7b3213e879faa2a83c7e9ea6e181.tar.xz | |
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 <jba@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ethan Lee <ethanalee@google.com>
Diffstat (limited to 'internal/datasource.go')
| -rw-r--r-- | internal/datasource.go | 4 |
1 files changed, 4 insertions, 0 deletions
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 |
