Tags: gofrs/uuid
Tags
Add IsZero method to UUID type for MongoDB omitzero support (#226) * Initial plan * Add IsZero method to UUID type for MongoDB omitzero support Co-authored-by: cameracker <14242948+cameracker@users.noreply.github.com> * Expand IsZero documentation to reference bsoncodec.Zeroer interface and GitHub issue Co-authored-by: cameracker <14242948+cameracker@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: cameracker <14242948+cameracker@users.noreply.github.com> Co-authored-by: Cameron Ackerman <cameron_ackerman@selinc.com>
Improve performance of FromBytesOrNil (#206) This pulls code from FromBytes and UnmarshalBinary into FromBytesOrNil which reduces the cost of creating a UUID from a byte slice. It also removes an allocation when the UUID is invalid as it no longer generates an error which is discarded. One downside of this approach is that it duplicates the logic from UnmarshalBinary. ``` goos: linux goarch: amd64 pkg: github.com/gofrs/uuid/v5 cpu: AMD Ryzen 9 5950X 16-Core Processor │ old.txt │ new.txt │ │ sec/op │ sec/op vs base │ FromBytesOrNil/valid-32 3.814n ± 0% 1.118n ± 1% -70.69% (n=100) FromBytesOrNil/empty-32 135.3500n ± 0% 0.6514n ± 1% -99.52% (n=100) geomean 22.72n 0.8534n -96.24% │ old.txt │ new.txt │ │ B/op │ B/op vs base │ FromBytesOrNil/valid-32 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=100) ¹ FromBytesOrNil/empty-32 96.00 ± 0% 0.00 ± 0% -100.00% (n=100) │ old.txt │ new.txt │ │ allocs/op │ allocs/op vs base │ FromBytesOrNil/valid-32 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=100) ¹ FromBytesOrNil/empty-32 2.000 ± 0% 0.000 ± 0% -100.00% (n=100) ```
Add "AtTime" generators for V1, V6, and V7 (#142) * add "AtTime" generators for V1, V6, and V7 * doc: update doc strings * fix: convenience methods * test: add tests for AtTime methods --------- Co-authored-by: Cameron Ackerman <cameron_ackerman@selinc.com>
PreviousNext