Documentation ¶ Overview ¶ Package uid 提供框架统一使用的全局唯一 ID 类型。 Package uid 基于 xid 生成短字符串 ID,并提供 Nil、New 与 From 等辅助函数。 service、runtime、entity、component 以及实体树节点关系都使用 uid.Id 作为稳定标识。 Index ¶ Variables type Id func (id Id) IsNil() bool func (id Id) String() string Constants ¶ This section is empty. Variables ¶ View Source var ( // Nil 是空 ID。 Nil Id = "" // New 生成新的 xid 字符串 ID。 New = func() Id { return Id(xid.New().String()) } // From 将字符串直接转换为 ID,不执行格式校验。 From = func(str string) Id { return Id(str) } ) Functions ¶ This section is empty. Types ¶ type Id ¶ type Id string Id 是框架统一使用的字符串标识类型。 func (Id) IsNil ¶ func (id Id) IsNil() bool IsNil 报告 ID 是否为空。 func (Id) String ¶ func (id Id) String() string String 返回 ID 的原始字符串。 Source Files ¶ View all Source files doc.goid.go Click to show internal directories. Click to hide internal directories.