index

package module
v0.0.0-...-1a760c1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2020 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package index is an unofficial library for index.golang.org.

It implements pagination, and exposes a language native structure, while retaining parametric control.

Example
m, err := Get(ctx, Inception, Page)
fmt.Println(len(m), err)
Output:

2000 <nil>

Index

Examples

Constants

This section is empty.

Variables

View Source
var Inception = Since(will(time.Parse(time.RFC3339, "2019-04-10T19:08:52.997264Z")))

Inception is the the oldest allowable timestamp.

While time.Time{} is valid, it is the oldest package in the index.

Functions

This section is empty.

Types

type Limit

type Limit uint

Limit is the maximum length of the returned list.

The default, zero, represents infinity.

Example
m, err := Get(ctx, Limit(1))
fmt.Println(m, err)
Output:

[{golang.org/x/text v0.3.0 2019-04-10 19:08:52.997264 +0000 UTC}] <nil>
const Page Limit = 2000

Page is the default page size for the index api.

type Module

type Module struct {
	// Path is the full import path.
	Path string `json:"Path"`
	// Version is a Semantic Version.
	Version string `json:"Version"`
	// Timestamp is when this was released.
	Timestamp time.Time `json:"Timestamp"`
}

Module is an entry in the index.

func Get

func Get(ctx context.Context, o ...Option) (_ []Module, err error)

Get fetches modules from the index.

Options can be provided to configure behaviour.

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option is a configuration parameter for Get.

type Since

type Since time.Time

Since is the the oldest allowable timestamp for module versions in the returned list.

Example
m, err := Get(ctx, Since(time.Now()))
fmt.Println(m, err)
Output:

[] <nil>

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL