Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/rs/xid
/ functions
Functions
58 in github.com/rs/xid
⨍
Functions
58
◇
Types & classes
4
↓ 7 callers
Method
Compare
Compare returns an integer comparing two IDs. It behaves just like `bytes.Compare`. The result will be 0 if two IDs are identical, -1 if current id is
id.go:343
↓ 5 callers
Function
New
New generates a globally unique ID
id.go:145
↓ 4 callers
Method
IsNil
IsNil Returns true if this is a "nil" ID
id.go:316
↓ 3 callers
Function
FromString
FromString reads an ID from its string representation
id.go:170
↓ 3 callers
Method
Scan
Scan implements the sql.Scanner interface.
id.go:301
↓ 3 callers
Method
UnmarshalText
UnmarshalText implements encoding/text TextUnmarshaler interface
id.go:224
↓ 2 callers
Method
Counter
Counter returns the incrementing value part of the id. It's a runtime error to call this method with an invalid id.
id.go:285
↓ 2 callers
Function
FromBytes
FromBytes convert the byte array representation of `ID` back to `ID`
id.go:331
↓ 2 callers
Method
Machine
Machine returns the 3-byte machine id part of the id. It's a runtime error to call this method with an invalid id.
id.go:273
↓ 2 callers
Method
MarshalText
MarshalText implements encoding/text TextMarshaler interface
id.go:184
↓ 2 callers
Function
NilID
NilID returns a zero value for `xid.ID`.
id.go:321
↓ 2 callers
Method
Pid
Pid returns the process id part of the id. It's a runtime error to call this method with an invalid id.
id.go:279
↓ 2 callers
Method
String
String returns a base32 hex lowercased with no padding representation of the id (char set is 0-9, a-v).
id.go:177
↓ 2 callers
Method
Time
Time returns the timestamp part of the id. It's a runtime error to call this method with an invalid id.
id.go:265
↓ 2 callers
Function
encode
encode by unrolling the stdlib base32 algorithm + removing all safe checks
id.go:200
↓ 1 callers
Method
Bytes
Bytes returns the byte array representation of `ID`
id.go:326
↓ 1 callers
Method
Len
()
id.go:349
↓ 1 callers
Method
Less
(i, j int)
id.go:353
↓ 1 callers
Function
NewWithTime
NewWithTime generates a globally unique ID with the passed in time
id.go:150
↓ 1 callers
Function
Sort
Sort sorts an array of IDs inplace. It works by wrapping `[]ID` and use `sort.Sort`.
id.go:363
↓ 1 callers
Method
Swap
(i, j int)
id.go:357
↓ 1 callers
Method
Value
Value implements the driver.Valuer interface.
id.go:292
↓ 1 callers
Function
decode
decode by unrolling the stdlib base32 algorithm + removing all safe checks
id.go:248
↓ 1 callers
Function
randInt
randInt generates a random uint32
id.go:136
↓ 1 callers
Function
readMachineID
readMachineId generates machine id and puts it into the machineId global variable. If this function fails to get the hostname, it will cause a runtime
id.go:116
↓ 1 callers
Function
readPlatformMachineID
()
hostid_linux.go:7
Function
BenchmarkFromString
(b *testing.B)
id_test.go:235
Function
BenchmarkNew
(b *testing.B)
id_test.go:219
Function
BenchmarkNewString
(b *testing.B)
id_test.go:227
Method
MarshalJSON
MarshalJSON implements encoding/json Marshaler interface
id.go:191
Function
TestFromBytes_InvalidBytes
(t *testing.T)
id_test.go:310
Function
TestFromBytes_Invariant
(t *testing.T)
id_test.go:299
Function
TestFromString
(t *testing.T)
id_test.go:108
Function
TestFromStringInvalid
(t *testing.T)
id_test.go:119
Function
TestIDDriverScan
(t *testing.T)
id_test.go:184
Function
TestIDDriverScanByteFromDatabase
(t *testing.T)
id_test.go:206
Function
TestIDDriverScanError
(t *testing.T)
id_test.go:196
Function
TestIDDriverValue
(t *testing.T)
id_test.go:173
Function
TestIDJSONMarshaling
(t *testing.T)
id_test.go:131
Function
TestIDJSONUnmarshaling
(t *testing.T)
id_test.go:143
Function
TestIDJSONUnmarshalingError
(t *testing.T)
id_test.go:157
Function
TestIDPartsExtraction
(t *testing.T)
id_test.go:45
Function
TestIDString
(t *testing.T)
id_test.go:101
Function
TestID_Compare
(t *testing.T)
id_test.go:328
Function
TestID_IsNil
func BenchmarkUUIDv1(b *testing.B) { b.RunParallel(func(pb *testing.PB) { for pb.Next() { _ = uuid.NewV1().String() } }) } func BenchmarkUUID
id_test.go:259
Function
TestNew
(t *testing.T)
id_test.go:64
Function
TestNilID
(t *testing.T)
id_test.go:286
Function
TestNilID_IsNil
(t *testing.T)
id_test.go:293
Function
TestSort
(t *testing.T)
id_test.go:389
Function
TestSorter_Len
(t *testing.T)
id_test.go:350
Function
TestSorter_Less
(t *testing.T)
id_test.go:359
Function
TestSorter_Swap
(t *testing.T)
id_test.go:372
Method
UnmarshalJSON
UnmarshalJSON implements encoding/json Unmarshaler interface
id.go:238
Function
init
()
id.go:96
Function
readPlatformMachineID
()
hostid_windows.go:11
Function
readPlatformMachineID
()
hostid_freebsd.go:7
Function
readPlatformMachineID
()
hostid_fallback.go:7
Function
readPlatformMachineID
()
hostid_darwin.go:7