resourceref

package
v0.0.0-...-ad3a29e Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type List

type List []Ref

func ListFromArgs

func ListFromArgs(args []string) (List, error)

ListFromArgs parses a List of resource references from a list of arguments. If something other than a resource label or numeric ID is specified, an error will be thrown.

func (List) ID

func (l List) ID() int

ID returns a numeric ID if the List contains only an ID. Otherwise, 0 is returned.

func (List) Identifiers

func (l List) Identifiers() (map[string]struct{}, map[int]struct{})

Identifiers gets all the label and id identifiers from the list.

func (List) Label

func (l List) Label() string

Label returns a label if the List contains only a single label. Otherwise, it's an empty string.

type Meta

type Meta struct {
	Label string
	ID    int
}

type Ref

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

Ref is a reference to a resource. This can either be an ID or Label.

func (Ref) ID

func (r Ref) ID() int

ID returns the reference as a numeric ID or 0.

func (Ref) Label

func (r Ref) Label() string

Label returns the reference as a string.

Jump to

Keyboard shortcuts

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