Documentation
¶
Overview ¶
Package ids hosts typed wrappers for cross-service entity IDs.
Passing typed IDs across boundaries makes it impossible to mistakenly swap a UserID for an OrgID — the compiler stops it. The wrapper embeds uuid.UUID so all the standard machinery (JSON marshalling, database/sql scanning, .String()) is inherited automatically and validation is real UUID parsing rather than a regex.
Add types as your domain grows. The pattern is uniform: a struct wrapping uuid.UUID, a New<Name> constructor for fresh IDs, and a Parse<Name> that delegates to uuid.Parse.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OrgID ¶
OrgID is a typed identifier for an organization.
func ParseOrgID ¶
ParseOrgID parses s as a UUID and returns it as an OrgID.
type UserID ¶
UserID is a typed identifier for a user.
func ParseUserID ¶
ParseUserID parses s as a UUID and returns it as a UserID. The underlying uuid.Parse handles canonical, URN, and braced forms; invalid input returns the zero UserID plus uuid's error.