Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added initializer for specifying own random data #6

Merged
merged 2 commits into from
Jul 24, 2021

Conversation

mufumade
Copy link
Contributor

This pull requests adds a initializer to ULID for specifying the date as well as own random data like so:

let ulid:ULID? = ULID(timestamp: timestamp, uuid: Data(someData))
  • In the case that the given data is too short then nil is returned.
  • If the given data is too long then the excess data is discarded.

@codecov-commenter
Copy link

codecov-commenter commented May 13, 2021

Codecov Report

Merging #6 (b0b7d99) into master (829acd3) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master       #6   +/-   ##
=======================================
  Coverage   98.95%   98.95%           
=======================================
  Files           4        4           
  Lines         574      576    +2     
=======================================
+ Hits          568      570    +2     
  Misses          6        6           
Impacted Files Coverage Δ
Sources/ULID/ULID.swift 100.00% <100.00%> (ø)
Tests/ULIDTests/ULIDTests.swift 98.40% <100.00%> (+0.16%) ⬆️
Sources/ULID/Data+Base32.swift 97.27% <0.00%> (-0.31%) ⬇️
Tests/ULIDTests/Data+Base32Tests.swift 100.00% <0.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 829acd3...b0b7d99. Read the comment docs.

@yaslab
Copy link
Owner

yaslab commented Jul 24, 2021

Thank you for your pull request!

I think this is a useful feature, so I'll merge it. However, I think that randomPartData is more appropriate than uuid for the second parameter name, so I'll fix it.

@yaslab yaslab merged commit 419d627 into yaslab:master Jul 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants