Documentation
¶
Index ¶
Constants ¶
View Source
const IDEncodedMaxLen = 27
IDEncodedMaxLen is the max length of an encoded ID (it can sometimes encode to something shorter).
Variables ¶
View Source
var ( ErrExists = errors.New("resource already exists") ErrNotFound = errors.New("resource not found") )
View Source
var GlobalID = ID{}
GlobalID is the zero value of ID, representing the ID of the abstract top-level "global" entity to which all resources belong.
Functions ¶
This section is empty.
Types ¶
type Common ¶ added in v0.2.0
Common provides functionality common to all resources.
func (Common) Ancestors ¶ added in v0.2.0
Ancestors provides a list of successive parents, starting with the direct parents.
func (Common) HasAncestor ¶ added in v0.2.0
type ID ¶
type ID struct {
Kind Kind
// contains filtered or unexported fields
}
ID is a unique identifier for a pug entity.
type Resource ¶
type Resource interface {
// GetID retrieves the unique identifier for the resource.
GetID() ID
// GetKind retrieves the kind of resource.
GetKind() Kind
// GetParent retrieves the resource's parent, the resource from which the
// resource was spawned.
GetParent() Resource
// HasAncestor determines whether the resource has an ancestor with the
// given ID.
HasAncestor(ID) bool
// Ancestors retrieves a list of the resource's ancestors, nearest first.
Ancestors() []Resource
// String is a human-readable identifier for the resource. Not necessarily
// unique across pug.
String() string
// Module retrieves the resource's module. Returns nil if the resource does
// not have a module ancestor.
Module() Resource
// Workspace retrieves the resource's workspcae. Returns nil if the resource does
// not have a workspace ancestor.
Workspace() Resource
// Run retrieves the resource's run. Returns nil if the resource does
// not have a run ancestor.
Run() Resource
}
Resource is a unique pug entity spawned from another entity.
Click to show internal directories.
Click to hide internal directories.