File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -98,12 +98,17 @@ func (id *ID) NextID() uint64 {
98
98
return timestampSegment | discriminatorSegment | sequenceSegment
99
99
}
100
100
101
+ // SID is the parsed representation of a snowflake ID.
101
102
type SID struct {
102
- Timestamp int64
103
- Sequence uint64
103
+ // Timestamp is the timestamp of the snowflake ID.
104
+ Timestamp int64
105
+ // Sequence is the sequence number of the snowflake ID.
106
+ Sequence uint64
107
+ // Discriminator is the discriminator value of the snowflake ID.
104
108
Discriminator uint64
105
109
}
106
110
111
+ // Parse parses an existing snowflake ID
107
112
func Parse (sid uint64 ) SID {
108
113
return SID {
109
114
Timestamp : getTimestamp (sid ),
@@ -169,13 +174,19 @@ func (id *ID2) NextID() uint64 {
169
174
return timestampSegment | discriminator2Segment | discriminator1Segment | sequenceSegment
170
175
}
171
176
177
+ // SID2 is the parsed representation of a snowflake ID with 2 discriminator fields.
172
178
type SID2 struct {
179
+ // Timestamp is the timestamp of the snowflake ID.
173
180
Timestamp int64
181
+ // Sequence is the sequence number of the snowflake ID.
174
182
Sequence uint64
183
+ // Discriminator1 is the first discriminator value of the snowflake ID.
175
184
Discriminator1 uint64
185
+ // Discriminator2 is the second discriminator value of the snowflake ID.
176
186
Discriminator2 uint64
177
187
}
178
188
189
+ // Parse2 parses an existing snowflake ID with 2 discriminator fields.
179
190
func Parse2 (sid uint64 ) SID2 {
180
191
return SID2 {
181
192
Timestamp : getTimestamp (sid ),
You can’t perform that action at this time.
0 commit comments