urn

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: GPL-3.0 Imports: 5 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// Scheme is the required scheme for all URNs in the system.
	Scheme = "urn"

	// --- Standard Namespaces (Helpers) ---
	// SecureMessaging is the legacy/core namespace ("sm").
	SecureMessaging = "sm"
	// AuthNamespace is for federated identities ("auth").
	AuthNamespace = "auth"
	// LookupNamespace is for database lookup keys ("lookup").
	LookupNamespace = "lookup"

	// EntityTypeUser is a standard entity type for users.
	EntityTypeUser = "user"
	// EntityTypeGroup is a standard entity type for groups.
	EntityTypeGroup = "group"
)

Variables

View Source
var (
	// ErrInvalidFormat is returned when a string or components do not conform
	// to the expected URN structure.
	ErrInvalidFormat = errors.New("invalid URN format")
)

Functions

func ToProto

func ToProto(native URN) *netv1.UrnPb

Types

type URN

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

URN represents a parsed, validated Uniform Resource Name.

func FromProto

func FromProto(proto *netv1.UrnPb) (URN, error)

func New

func New(namespace, entityType, entityID string) (URN, error)

New is the constructor for a URN. REFACTOR: Removed namespace validation. This is now a general-purpose URN container.

func Parse

func Parse(s string) (URN, error)

Parse converts a URN string into a validated URN struct.

func (URN) EntityID

func (u URN) EntityID() string

func (URN) EntityType

func (u URN) EntityType() string

func (URN) IsZero

func (u URN) IsZero() bool

func (URN) MarshalJSON

func (u URN) MarshalJSON() ([]byte, error)

func (URN) Namespace

func (u URN) Namespace() string

func (URN) String

func (u URN) String() string

String implements the fmt.Stringer interface.

func (*URN) UnmarshalJSON

func (u *URN) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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