Help us shape the future of Go! Take the 2026 Go Developer Survey

id

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package id generates prefixed, sortable, opaque identifiers: app_01HQ8..., spec_..., usr_...

ULID body. The prefix is load-bearing — it makes log lines self-describing and copy-paste mistakes visible, which is why IDs are text rather than uuid in the schema.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Is

func Is(k Kind, s string) bool

Is reports whether s is a well-formed identifier of kind k.

Use it at API boundaries. Rejecting an app ID handed to a volume endpoint produces a clear error instead of a lookup that mysteriously finds nothing — which is the whole reason the prefix exists.

func New

func New(k Kind) string

New returns a fresh prefixed, sortable, opaque identifier: app_01HQ8...

The body is a ULID, so IDs sort by creation time. That property is relied on for cursor pagination and makes a sorted list of IDs chronological without a join.

func Time

func Time(s string) (time.Time, error)

Time returns when an identifier was generated.

Types

type Kind

type Kind string

Kind is an object's ID prefix.

The prefix is load-bearing, not decoration (design 00 §3.1): it makes log lines and error messages self-describing, and it makes copy-paste mistakes visible at a glance rather than at the point of a confusing 404.

const (
	App          Kind = "app"
	Spec         Kind = "spec"
	Deployment   Kind = "dep"
	User         Kind = "usr"
	Group        Kind = "grp"
	Token        Kind = "tok"
	Session      Kind = "ses"
	Role         Kind = "role"
	Grant        Kind = "gr"
	Volume       Kind = "vol"
	Secret       Kind = "sec"
	Service      Kind = "svc"
	Backup       Kind = "bkp"
	Notification Kind = "ntf"
	IdentityAdpt Kind = "idp"
	Request      Kind = "req"

	// Scan is a security scan of one spec revision (R-310).
	Scan Kind = "scan"

	// Section is a grouping in one person's launcher (R-342). Not "sec",
	// which is a secret.
	Section Kind = "sect"

	// AuditArchive is one archived month of the audit log (R-347).
	AuditArchive Kind = "aar"

	// Upgrade is one in-place upgrade of Pando itself (R-359).
	Upgrade Kind = "upg"

	// Event, Subscription and Delivery are the outbox, a subscription to it,
	// and one event sent to one subscription (issue #50, R-366).
	Event        Kind = "evt"
	Subscription Kind = "sub"
	Delivery     Kind = "dlv"

	// Replica is one running Pando process (issue #72). Fresh on every start:
	// a restarted process is a new replica, which is how work the old one had
	// under way is recognized as nobody's.
	Replica Kind = "rep"

	// Adapter configs are prefixed by category, so a log line naming one says
	// which kind of adapter it is (design 02 §2.5).
	AdapterRuntime  Kind = "rt"
	AdapterRouting  Kind = "rte"
	AdapterBuilder  Kind = "bld"
	AdapterSecrets  Kind = "sek"
	AdapterServices Kind = "svcs"
	AdapterNotify   Kind = "ntf"
	AdapterScanner  Kind = "scn"
)

func Parse

func Parse(s string) (Kind, ulid.ULID, error)

Parse splits an identifier into its kind and ULID body, validating both.

Jump to

Keyboard shortcuts

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