Parse decodes a string-encoded representation of a KSUID object
(s string)
| 175 | |
| 176 | // Parse decodes a string-encoded representation of a KSUID object |
| 177 | func Parse(s string) (KSUID, error) { |
| 178 | if len(s) != stringEncodedLength { |
| 179 | return Nil, errStrSize |
| 180 | } |
| 181 | |
| 182 | src := [stringEncodedLength]byte{} |
| 183 | dst := [byteLength]byte{} |
| 184 | |
| 185 | copy(src[:], s[:]) |
| 186 | |
| 187 | if err := fastDecodeBase62(dst[:], src[:]); err != nil { |
| 188 | return Nil, errStrValue |
| 189 | } |
| 190 | |
| 191 | return FromBytes(dst[:]) |
| 192 | } |
| 193 | |
| 194 | func timeToCorrectedUTCTimestamp(t time.Time) uint32 { |
| 195 | return uint32(t.Unix() - epochStamp) |
searching dependent graphs…