results

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2019 License: Apache-2.0 Imports: 5 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// OK - Query completed successfully, with results
	OK = Status(0)
	// NotFound - Query completed successfully, without results
	NotFound = Status(1)
	// Unavailable - Provider could not be reached
	Unavailable = Status(2)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	Name      string
	Version   version.Version
	Location  string
	Published time.Time
}

Result contains the information for a single query result

func NewResult

func NewResult(name, v string, location string, published time.Time) *Result

NewResult creates a result with the specified values

func (*Result) Print

func (r *Result) Print()

Print pretty-prints a single Result

func (*Result) PrintSimple

func (r *Result) PrintSimple()

PrintSimple only prints the version and the location of the latest release

type ResultSet

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

ResultSet is a collection of the Results of a Provider query

func NewResultSet

func NewResultSet(query string) *ResultSet

NewResultSet creates as empty ResultSet for the provided query

func (*ResultSet) AddResult

func (rs *ResultSet) AddResult(r *Result)

AddResult appends a new Result

func (*ResultSet) Empty

func (rs *ResultSet) Empty() bool

Empty checks if there were no results

func (*ResultSet) First

func (rs *ResultSet) First() *Result

First retrieves the first result from a query

func (*ResultSet) Last

func (rs *ResultSet) Last() *Result

Last retrieves the first result from a query

func (*ResultSet) Len

func (rs *ResultSet) Len() int

Len is the number of elements in the ResultSet (sort.Interface)

func (*ResultSet) Less

func (rs *ResultSet) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j. (sort.Interface)

func (*ResultSet) PrintAll

func (rs *ResultSet) PrintAll()

PrintAll pretty-prints an entire ResultSet

func (*ResultSet) PrintFirst

func (rs *ResultSet) PrintFirst()

PrintFirst pretty-prints the first result

func (*ResultSet) Swap

func (rs *ResultSet) Swap(i, j int)

Swap swaps the elements with indexes i and j.

type Status

type Status uint8

Status indicates the state of a query upon completion

Jump to

Keyboard shortcuts

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