dagaddress

package
v1.0.0-beta.15 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package dagaddress parses and prints DAG addresses: URLs that select workspace artifacts.

[dag[+<type>[+<type>...]]://][<workspace>@<version>:][<path>][?<dimension>=<key>&...]

The scheme marks a workspace artifact address. Without it, the value is a relative address. In a relative address, ":" is accepted as a path separator for compatibility. In an absolute address, the first ":" after "@" ends the version, and later colons in the path are the old separator. Neither separator splits a key: the query is split off first.

Index

Constants

View Source
const Scheme = "dag"

Scheme is the URL scheme of a DAG address.

Variables

This section is empty.

Functions

func IsAddress

func IsAddress(value string) bool

IsAddress reports whether value starts with the DAG scheme. It does not validate the rest of the value.

Types

type Address

type Address struct {
	// HasScheme reports whether the value started with "dag://" or "dag+type://".
	HasScheme bool
	// Types lists the "+<type>" segments of the scheme, in CLI case.
	Types []string
	// Absolute reports whether the value carried "<workspace>@<version>:".
	Absolute bool
	// Workspace is the Git address of the workspace, written as a Go import path.
	Workspace string
	// Version is the branch, tag, or commit of an absolute address.
	Version string
	// Path is the field path with "/" separators. It may be a pattern. Empty
	// selects all artifacts.
	Path string
	// Query lists the dimension selectors in input order.
	Query []Pair
}

Address is a parsed DAG address.

func Parse

func Parse(value string) (*Address, error)

Parse parses value as a DAG address. A value with another URL scheme is an error: it is an external reference, not an artifact address.

func (*Address) DimensionFilters

func (addr *Address) DimensionFilters() []DimensionFilter

DimensionFilters groups the query pairs by dimension, in first-seen order. A pair without a key makes the whole dimension match any key.

func (*Address) String

func (addr *Address) String() string

String prints the address with the scheme, in canonical form.

type DimensionFilter

type DimensionFilter struct {
	Dimension string
	Keys      []string
}

DimensionFilter groups the query by dimension: repeated dimensions are alternatives, and different dimensions combine with AND. Nil keys select any key in the dimension.

type Pair

type Pair struct {
	Dimension string
	Key       string
	HasKey    bool
}

Pair is one dimension selector from the query. A pair without a key selects any key in the dimension.

Jump to

Keyboard shortcuts

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