uid

package
v0.4.27 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: LGPL-2.1 Imports: 1 Imported by: 23

Documentation

Overview

Package uid 提供框架统一使用的全局唯一 ID 类型。

Package uid 基于 xid 生成短字符串 ID,并提供 Nil、New 与 From 等辅助函数。

service、runtime、entity、component 以及实体树节点关系都使用 uid.Id 作为稳定标识。

Index

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 的原始字符串。

Jump to

Keyboard shortcuts

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