gofrs / uuid

A UUID package for Go
MIT License
1.57k stars 110 forks source link

initial implementation of UUIDv6 and UUIDv7 based on RFC Draft Rev 2 #93

Closed theckman closed 2 years ago

theckman commented 3 years ago

There is currently an RFC draft in progress[1] to add three new UUID formats, versions 6, 7, and 8, that change the internal data format so that the generated UUIDs are k-sortable. Version 8 is a special UUID format designed for future implementations or extensions, and as a result isn't implemented here.

Because this impelmentation is based on a draft RFC, they may be subject to change in later revisions. As such, these new functions/methods include a comment indicating they do not yet fall under the API compatibility guarantee of the project, and changes to meet new revisions to the spec will be done in minor releases.

[1] https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-02

codecov-commenter commented 3 years ago

Codecov Report

Merging #93 (03e219b) into master (8e62f78) will increase coverage by 0.39%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #93      +/-   ##
==========================================
+ Coverage   98.87%   99.27%   +0.39%     
==========================================
  Files           4        4              
  Lines         356      549     +193     
==========================================
+ Hits          352      545     +193     
  Misses          3        3              
  Partials        1        1              
Impacted Files Coverage Δ
generator.go 98.66% <100.00%> (+2.08%) :arrow_up:
uuid.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8e62f78...03e219b. Read the comment docs.

theckman commented 2 years ago

So I updated my commit but codecov did not update the comment to indicate I'd fixed the coverage decrease...

theckman commented 2 years ago

There we go...

cameracker commented 2 years ago

I guess one more question, do you think we'd benefit from a test that verifies these are sortable as we expect?

theckman commented 2 years ago

@cameracker I could probably do that in one of the tests I currently have where I generate a bunch of UUIDs to actually exercise the clock sequence generator. I could fail the test if the previous UUID isn't < the current one.

I'll add that in tonight.

theckman commented 2 years ago

Confirmed we are compatible with Revision 2 of the RFC Draft. Updated the PR to reflect that, and added the tests. Ready for review+merge.

johanbrandhorst commented 2 years ago

Do we need to update the README for this or are we waiting for stabilization?

cameracker commented 2 years ago

Thanks @johanbrandhorst , I took a swing at that here: #94