identifier

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NativeNamespaceRepo            = "r/"
	NativeNamespaceRepoChar        = "r"
	NativeNamespaceUserAddress     = "a/"
	NativeNamespaceUserAddressChar = "a"
	NativeNamespaceRegexp          = "^[ar]{1}/[a-zA-Z0-9_-]{0,}$"           // e.g r/abc-xyz, a/abc-xyz, r/, a/
	NativeNamespaceRepoRegexp      = "^[r]{1}/[a-zA-Z0-9_-]{0,}$"            // e.g r/abc-xyz, r/
	NativeNamespaceAddressRegexp   = "^[a]{1}/[a-zA-Z0-9_-]{0,}$"            // e.g a/abc-xyz, a/
	FullNativeNamespaceRegexp      = "^[ar]{1}/[a-zA-Z0-9_-]+$"              // e.g r/abc-xyz or a/abc-xyz
	UserNamespaceRegexp            = "^[a-zA-Z0-9_-]{3,}/[a-zA-Z0-9_-]{0,}$" // e.g namespace/abc-xyz_ (excluding: r/abc-xyz)
	WholeNamespaceRegexp           = "^([a-zA-Z0-9_-]+)/[a-zA-Z0-9_-]+$"     // e.g namespace/abc-xyz_, r/abc-xyz
)
View Source
const MaxResourceNameLength = 128

Variables

This section is empty.

Functions

func GetDomain

func GetDomain(str string) string

GetDomain returns the domain part of a whole namespace. URI

Example: r/abc => abc , a/os1 => os1 , ns1/abc => abc

func GetNamespace

func GetNamespace(str string) string

GetNamespace returns the namespace part of a whole namespace. URI

Example: r/abc => r , a/os1 => a , ns1/abc => ns1

func IsFullNamespaceURI

func IsFullNamespaceURI(str string) bool

IsFullNamespaceURI checks whether the given string is a whole namespace URI.

Example: r/domain, ns1/domain, a/os1abc

func IsFullNativeNamespaceURI

func IsFullNativeNamespaceURI(str string) bool

IsFullNativeNamespaceURI checks whether the given string is a whole native user address or repo namespace URI.

Example: a/os1abc , r/repo

func IsNamespaceURI

func IsNamespaceURI(str string) bool

IsNamespaceURI checks whether the given string is a valid namespace.

Example: user-ns/domain, user-ns/, r/repo, r/, a/, a/os1abc

func IsNativeNamespaceURI

func IsNativeNamespaceURI(str string) bool

IsNativeNamespaceURI checks whether the given string is a whole or partial native namespace URI.

Example: r/repo, a/os1abc, r/, a/

func IsNativeRepoNamespaceURI

func IsNativeRepoNamespaceURI(str string) bool

IsNativeRepoNamespaceURI checks whether the address is a whole or partial native repo namespace URI.

Example: r/repo, r/

func IsUserAddressURI

func IsUserAddressURI(str string) bool

IsUserAddressURI checks whether the address is a whole or partial user address namespace URI.

Example: a/os1abc, a/

func IsUserNamespaceURI

func IsUserNamespaceURI(str string) bool

IsUserNamespaceURI checks whether the given string is a whole or partial user-defined namespace URI.

Example: ns1/domain, ns1/

func IsValidResourceName

func IsValidResourceName(name string) error

IsValidResourceName checks whether a user-defined name is valid as a resource name

func IsValidResourceNameNoMinLen

func IsValidResourceNameNoMinLen(name string) error

IsValidResourceNameNoMinLen is like IsValidResourceName but minimum length is not enforced.

func IsValidScope

func IsValidScope(addr string) bool

IsValidScope checks whether and address can be used as a scope

func IsValidUserAddr

func IsValidUserAddr(str string) error

IsValidUserAddr checks whether a bech32 user address is valid

func IsWholeNativeRepoURI

func IsWholeNativeRepoURI(str string) bool

IsWholeNativeRepoURI checks whether the given string is a whole native repo namespace URI.

Example: r/repo

func IsWholeNativeURI

func IsWholeNativeURI(str string) bool

IsWholeNativeURI checks whether the given string is a full native namespace URI.

Example: r/repo, a/os1abc

func IsWholeNativeUserAddressURI

func IsWholeNativeUserAddressURI(str string) bool

IsWholeNativeUserAddressURI checks whether the given string is a whole native user address namespace URI.

Example: a/os1abc

Types

type Address

type Address string

Address represents an identifier for a resource

func (Address) Equal

func (a Address) Equal(addr Address) bool

Equal checks whether a is equal to addr

func (Address) IsEmpty

func (a Address) IsEmpty() bool

IsEmpty checks whether the address is empty

func (Address) IsFullNamespace

func (a Address) IsFullNamespace() bool

IsFullNamespace checks whether the address is a full namespace path.

func (Address) IsFullNativeNamespace

func (a Address) IsFullNativeNamespace() bool

IsFullNativeNamespace checks whether the address is prefixed with a/ or /r which indicates a repo and account address respectively

func (Address) IsNamespace

func (a Address) IsNamespace() bool

IsNamespaceURI checks whether the given address is a valid native or user namespace

func (Address) IsNativeNamespace

func (a Address) IsNativeNamespace() bool

IsNativeNamespace checks whether the given address is a native namespace

func (Address) IsNativeNamespaceRepo

func (a Address) IsNativeNamespaceRepo() bool

IsNativeNamespaceRepo checks whether the address is a native namespace address for repositories

func (Address) IsNativeNamespaceUserAddress

func (a Address) IsNativeNamespaceUserAddress() bool

IsNativeNamespaceUserAddress checks whether the address is a native namespace address for users

func (Address) IsNativeRepoAddress

func (a Address) IsNativeRepoAddress() bool

IsNativeRepoAddress checks if the address is native repo address

func (Address) IsNativeUserAddress

func (a Address) IsNativeUserAddress() bool

IsNativeUserAddress checks if the address is native user address

func (Address) IsUserAddress

func (a Address) IsUserAddress() bool

IsUserAddress checks whether the address is a bech32 user address.

func (Address) IsUserNamespace

func (a Address) IsUserNamespace() bool

IsUserNamespace checks whether the address is a user

func (Address) IsValidNativeAddress

func (a Address) IsValidNativeAddress() bool

IsValidNativeAddress checks whether the address is a valid native namespace address

func (Address) String

func (a Address) String() string

Jump to

Keyboard shortcuts

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