package index

import "golang.org/x/pkgsite/internal/index"

Package index provides a client for communicating with the module index.

Index

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

A Client is used by the worker service to communicate with the module index.

func New

func New(rawurl string) (_ *Client, err error)

New constructs a *Client using the provided rawurl, which is expected to be an absolute URI that can be directly passed to http.Get.

func SetupTestIndex

func SetupTestIndex(t *testing.T, versions []*internal.IndexVersion) (*Client, func())

SetupTestIndex creates a module index for testing using the given version map for data. It returns a function for tearing down the index server after the test is completed, and a Client for interacting with the test index.

func (*Client) GetVersions

func (c *Client) GetVersions(ctx context.Context, since time.Time, limit int) (_ []*internal.IndexVersion, err error)

GetVersions queries the index for new versions.

Source Files

index.go test_helper.go

Version
v0.0.0-20250218150137-224a1368cf02 (latest)
Published
Feb 18, 2025
Platform
linux/amd64
Imports
14 packages
Last checked
2 months ago

Tools for package owners.