subtypes

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2021 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package subtypes provides helpers to work with boundary resource subtypes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

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

Registry stores a collection of boundary resource subtypes along with their prefixes and allows for translating prefixes back to registered subtypes. Registry is not thread safe.

func NewRegistry

func NewRegistry() *Registry

New Registry creates a new boundary resource subtype registry.

func (*Registry) Register

func (r *Registry) Register(subtype Subtype, prefixes ...string) error

Register registers all the prefixes for a provided Subtype. Register returns an error if the subtype has already been registered or if any of the prefixes are associated with another subtype.

func (*Registry) SubtypeFromId

func (r *Registry) SubtypeFromId(id string) Subtype

SubtypeFromId returns the Subtype from the provided id if the id's prefix was registered with a Subtype. Otherwise Unknown is returned.

func (*Registry) SubtypeFromType

func (r *Registry) SubtypeFromType(t string) Subtype

SubtypeFromType returns the Subtype from the provided string or if no Subtype was registered with that string Unknown is returned.

type Subtype

type Subtype string

Subtype variables identify a boundary resource subtype.

const (
	UnknownSubtype Subtype = "unknown"
)

func (Subtype) String

func (t Subtype) String() string

String returns the string representation of a Subtype

Jump to

Keyboard shortcuts

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