urn

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package urn is Blitz's resource names (spec_055_urns): one URN for each thing an organization's service keeps, made only of IDs, such as urn:blitz:runs:<run-id> or urn:blitz:artifacts:<workspace-id>:<job-id>:<run-id>/report.csv.

Index

Constants

This section is empty.

Variables

View Source
var ErrName = errors.New("not a Blitz resource name")

ErrName is Parse's error for a string that isn't a resource name.

Functions

This section is empty.

Types

type Kind

type Kind string

Kind is what a name names (RN-10, RN-12).

const (
	Users      Kind = "users"
	Groups     Kind = "groups"
	Workspaces Kind = "workspaces"
	Jobs       Kind = "jobs"
	Runs       Kind = "runs"
	Content    Kind = "content"
	Artifacts  Kind = "artifacts"
)

The kinds.

type Name

type Name struct {
	Kind Kind
	IDs  []string
	// Path is a file's, "/"-separated and not encoded ("" for none).
	Path string
}

Name is a resource name: a kind, its IDs (none for a collection, RN-03), and for artifacts a file's path under them.

func New

func New(k Kind, id ...string) (Name, error)

New is the name of one thing of kind k with these IDs.

func Parse

func Parse(s string) (Name, error)

Parse reads a resource name; urn and blitz may be in any case (RN-02), IDs too, and the result has them in lower case.

func (Name) File

func (n Name) File(path string) (Name, error)

File is the name of a file under n, an artifacts name (RN-12).

func (Name) IsCollection

func (n Name) IsCollection() bool

IsCollection says whether n names every thing of its kind.

func (Name) MarshalText

func (n Name) MarshalText() ([]byte, error)

MarshalText writes n as its URN.

func (Name) Parent

func (n Name) Parent() (Name, bool)

Parent is the name n is under: a file's thing, or for a thing with several IDs, the same kind with its last one dropped; ok is false for a collection or a thing with one ID.

func (Name) String

func (n Name) String() string

String is n as a URN, its path encoded (RN-01, RN-02).

func (*Name) UnmarshalText

func (n *Name) UnmarshalText(b []byte) error

UnmarshalText reads a URN into n.

Jump to

Keyboard shortcuts

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