id

package
v0.60.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 2 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ServerStringIDBase uint32 = 0x80000000

ServerStringIDBase is the base offset for server-only string IDs to prevent collisions with client string IDs.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

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

Generator generates unique IDs for different namespaces. It is safe for concurrent use.

func NewGenerator

func NewGenerator() *Generator

NewGenerator creates a new Generator initialized with starting counter values.

func (*Generator) New

func (g *Generator) New(ns Namespace) uint32

New allocates a fresh uint32 ID in the given namespace. IDs start from 1 (or ServerStringIDBase + 1 for ServerString).

func (*Generator) Set

func (g *Generator) Set(ns Namespace, value uint32)

Set sets the current value of the ID counter for the given namespace.

type Namespace

type Namespace uint32

Namespace represents a namespace for generating unique IDs.

const (
	// String is the namespace for string IDs.
	String Namespace = iota
	// ServerString is the namespace for server-only string IDs.
	ServerString
	// FieldSet is the namespace for field set IDs.
	FieldSet
	// Struct is the namespace for struct IDs.
	Struct
	// TimelinePath is the namespace for timeline path IDs.
	TimelinePath
	// TimelineItems is the namespace for timeline items IDs.
	TimelineItems
	// TemporaryLog is the namespace for parser-side temporary log IDs.
	TemporaryLog
	// Log is the namespace for finalized/serialized log IDs.
	Log
)

Jump to

Keyboard shortcuts

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